Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to implement jquery Timeago with php?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 162
    Comment on it

    Hello Reader's ,

    We can see that posting & Online time changes frequently seconds ago, minutes ago and hours ago etc, In Social media. So Today in my blog I am going explain about timeago and its easy implementation with PHP.

    First, you need to include JavaScript library.

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.livequery.js"></script>
    <script type="text/javascript" src="js/jquery.timeago.js"></script>
    <script type="text/javascript">
    $(document).ready(function(){
    $(".timeago").livequery(function() // LiveQuery 
    {
    $(this).timeago(); // Calling Timeago Function 
    });
    });
    </script>

     

    Then add below code.

    <?php
    $time=time(); // Current time-stamp eg: 1371612613
    $mtime=date("c", $time); // Converts to date format 2013-06-19T03:30:13+00:00 
    ?>
    
    
    You opened this page <a href='#' class='timeago' title="<?php echo $mtime; ?>"></a>

    You can get supported .js file by downloading a source code.

     

    Please feel free to give us your feedback in comments.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: