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


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

Related Posts:

2 Responses


ravindra May 28, 2008 at 5:02 am

strtotime() funtion need parameter


Tun Tun May 28, 2008 at 5:02 am

Thank , it is work perfectly


Comments are closed.