Skip to content

Instantly share code, notes, and snippets.

@ravidsrk
Created January 28, 2012 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ravidsrk/1694723 to your computer and use it in GitHub Desktop.
Save ravidsrk/1694723 to your computer and use it in GitHub Desktop.
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