Use this code for the difference between two dates:
$date1 = '2012-12-12'; $date2 = '2012-12-20'; $start_date = strtotime($date1); $end_date = strtotime($date2); echo ($end_date - $start_date)/60/60/24;
Simple like that:
$start_date = strtotime('2012-12-12'); $end_date = strtotime('2012-12-20'); echo ($end_date - $start_date)/60/60/24;