Create a gist now

Instantly share code, notes, and snippets.

PHP Date difference in Days
<?php
function dateDiff($start, $end) {
$start_ts = strtotime($start);
$end_ts = strtotime($end);
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
echo dateDiff("2012-01-28", "2012-01-27");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment