I'm confused... That's exactly how I've got it coded on my page.
E.g.
I take it I'm doing something wrong..? Sorry like I said earlier my php knowledge is very limited!PHP Code:<html>
<head>
</head>
<body>
<?php
function plural($num) {
if ($num != 1)
return "s";
}
function getRelativeTime($date) {
$diff = time() - $date;
if ($diff<60)
return $diff . " second" . plural($diff) . " ago";
$diff = round($diff/60);
if ($diff<60)
return $diff . " minute" . plural($diff) . " ago";
$diff = round($diff/60);
if ($diff<24)
return $diff . " hour" . plural($diff) . " ago";
$diff = round($diff/24);
if ($diff<7)
return $diff . " day" . plural($diff) . " ago";
$diff = round($diff/7);
if ($diff<4)
return $diff . " week" . plural($diff) . " ago";
return "on " . date("F j, Y", strtotime($date));
}
// Unix timestamp for today at 17:21:19, replace this with a timestamp for whenever you want
$stampystamp = 1295803279;
// Display the number of seconds/minutes/hours/days/weeks since the timestamp
echo getRelativeTime($stampystamp);
?>
</body>
</html>





Reply With Quote



. When I changed the timestamp (I change it too 2/3 days ago) it worked fine.




