We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1570
    • 38 Posts
    i want to format the date output in Jot makeing it eg. 2mins ago,5hrs ago, ect.... like youtube has in its comments.

    This php function will do the trick:

    <?php
    function ago($timestamp){
       $difference = time() - $timestamp;
       $periods = array("second", "minute", "hour", "day", "week", "month", "years", "decade");
       $lengths = array("60","60","24","7","4.35","12","10");
       for($j = 0; $difference >= $lengths[$j]; $j++)
       $difference /= $lengths[$j];
       $difference = round($difference);
       if($difference != 1) $periods[$j].= "s";
       $text = "$difference $periods[$j] ago";
       return $text;
      }
    ?>


    However it needs to be implements in PHx as the output of Jot is held in an html chunk include so only PHx can be used as far as i know.

    Can it be done??
      • 26931
      • 2,314 Posts