day from two dates
function days_between($date1, $date2) { $tmp = DateTime::createFromFormat('Y-m-d', $date1); $start = $tmp->getTimestamp(); $tmp = DateTime::createFromFormat('Y-m-d', $date2); $end = $tmp->getTimestamp(); return round(($end - $start) / (60 * 60 * 24)); }