So I have a datetime string, and I want it to have an output that's human readable that says how long until that time comes up. So far, I have it saying days, but I'd also like this function that if it's less than a day, it will say how many hours from now, and if it's less than an hour, it will say how many minutes from now.
Right now, I have:
function days_until($date){
$days_from_now = (isset($date)) ? floor((strtotime($date) - time())/60/60/24) : FALSE;
return $days_from_now.' Days From Now';
}
But what I noticed is that it will return with 0 days from now if it's already that day.