Showing posts with label How can we know the number of days between two given dates using PHP?. Show all posts
Showing posts with label How can we know the number of days between two given dates using PHP?. Show all posts

Sunday, May 10, 2009

How can we know the number of days between two given dates using PHP?

Simple arithmetic:

$date1 = date('Y-m-d');
$date2 = '2006-07-01';
$days = (strtotime() - strtotime()) / (60 * 60 * 24);
echo "Number of days since '2006-07-01': $days";