This question already has an answer here:
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?
Below code will give the output for number of days, by taking out the difference between two dates..
strtotime will convert your date string to a unix time stamp. (seconds since the unix epoch.
I would recommend to use date->diff function, as in example below:
see http://www.php.net/manual/en/datetime.diff.php