In the function below a possible output maybe
1 day and 2 hours and 34 minutes
My question is how do I edit the implode so it will output
1 day, 2 houts and 34 minutes
This is my function
function time_difference($endtime){
$hours = (int)date("G",$endtime);
$mins = (int)date("i",$endtime);
// join the values
$diff = implode(' and ', $diff);
if (($hours == 0 ) && ($mins == 0)) {
$diff = "few seconds ago";
}
return $diff;
}
Something like this?
There are a lot of places for x-time-ago functions. here are two in PHP. Here's one in Javascript.
I would do something like: