Possible Duplicate:
How to calculate the difference between two dates using PHP?
Hello everyone I need calculate the exact total number of days between two dates. It is easy to date using PHP DateTime object's diff() method. However I don't have access to PHP 5.3
So what is the best way to calculate total number of days beetwen two dates?
$date1 = new DateTime('2011-01-01');
$date2 = new DateTime('2011-04-23');
$totalDaysBetween = ???
It should also be able to handle leap years.
Any ideas?