Thursday, November 13, 2008

Calculating difference between two dates in days in PHP

Calculating the days between two dates is so easy in php, you can even calculate the hours, minutes and seconds between two dates

$date1 = "2008-06-11";
$date2 = "2009-05-09";

$diff = strtotime($date2) - strtotime($date1);
$days = $diff/(60*60*24);

No comments: