Hey everyone im trying to display relative date and time messages to the user, so for example if the file was updated less then 5 seconds ago the message the user will see is: 'Updated Just Now' however it doesnt seem to be working.
Here is the code that I am using
function relativeTime($date) {
$timeNow = date('M d Y H:s');
if ($date == $timeNow || $date == date('M d Y H:s', + 500)) {
echo "Updated Just Now";
} else {
echo "not now";
}
}
This is where I am displaying it and passing it the argument:
<?php relativeTime(dateUTCtoLocal("M d Y H:s", $arrSchool["updated"]));?>
I eventually will have a few if's in there for minute and hours, am I going about this the right way?
Thanks in advance.