Is there a quick way to calculate date difference in php? For example:
$date1 = '2009-11-12 12:09:08';
$date2 = '2009-12-01 08:20:11';
And then do a calculation, $date2 minus $date1
I read php.net documentation, but no luck. Is there a quick way to do it?
EDIT:
I will put up the whole answer (for some people who might curious of how to do it)
$date1 = '2009-12-20 20:12:10';
$date2 = '2009-12-24 12:12:10';
$ts1 = strtotime($date1);
$ts2 = strtotime($date2);
$seconds_diff = $ts2 - $ts1;
echo floor($seconds_diff/3600/24);
Result return in "days", you can get your desired result by playing the $seconds_diff, which is the difference in seconds