ProAnswers.org

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

$date1 = date(‘Y-m-d’);
$date2 = ‘2011-07-01’;
$days = (strtotime() - strtotime()) / (60 * 60 * 24);
echo “Number of days since ‘2011-07-01’: $days”;