Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $eventTime = '2013-06-04 23:23:23';
- $age = time() - strtotime($eventTime);
- if (60 > $age) {
- echo ($age) . ' Seconds Ago';
- exit;
- }
- if (3600 > $age) {
- echo round($age / 60, 0) . ' Minutes Ago';
- exit;
- }
- if (86400 > $age) {
- echo round($age / 3600, 0) . ' Hours Ago';
- exit;
- }
- if ($age > 86400) {
- echo round($age / 86400, 0) . ' Days Ago';
- exit;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment