find interval between two dates using php
by Guna[ Edit ] 2012-07-23 14:59:55
Below snippet will lets you to find number of days between two dates. It uses strtotime() function for this purpose.
function dateDiff($start, $end) {
$start_ts = strtotime($start);
$end_ts = strtotime($end);
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
echo dateDiff("10-3-2011","29-3-2012");