Is there any function equivalent to DateTime::diff() in PHP 5.2?
My local server is PHP 5.3 and using DateTime::diff(). then I found that my live site uses PHP 5.2 a
Spudley was close, but you need to use gmdate not date.
So this works for 24 hours or less (if it's a positive value at least):
$difference = $date2->format('U') - $date1->format('U'); $time_diff = gmdate('H:i:s',$difference);