So i have this function to show the time generated from the inserted unix format timestamp(time()):
function get_time($timestamp) {
$time = date('G:i', $timestamp);
echo " at: ".$time;
return $time;
}
I would like to expand this function and would like to do so if it has been under 24 hours, it should calculate and echo "x hours ago", if its yesterday or later, it should just echo like it does now ( echo " at: ".$time; ) ..
How can this be done?