/ Published in: PHP
i dont see who is the author of this script, but i want to say him a lot thanks and would like to performance to him (and to everybody) a modification of this script.. i have modified it a bit and it is absolutely like on fb.. new "featchures" are:
instead -
* 1-59 seconds, minutes, hours - nothing modified;
* 1 day ago: Yesterday at --:--
* 2-7 days ago: Monday (or other day of the week) at --:--
* 1 week ago etc.: Dec 27, 2013 at 22:06 (for example)
instead -
* 1-59 seconds, minutes, hours - nothing modified;
* 1 day ago: Yesterday at --:--
* 2-7 days ago: Monday (or other day of the week) at --:--
* 1 week ago etc.: Dec 27, 2013 at 22:06 (for example)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function ago($time) { if ($diff == 0) { return 'Just now'; } ); $ago = $value.' '.$intervals[1][0].($value > 1 ? 's' : ''); if ($ago == '1 day') { } elseif ($ago == '2 days' || $ago == '3 days' || $ago == '4 days' || $ago == '5 days' || $ago == '6 days' || $ago == '7 days') { } elseif ($value <= 59 && $intervals[1][0] == 'second' || $intervals[1][0] == 'minute' || $intervals[1][0] == 'hour') { return $ago.' ago'; } else { } } ?>