Skip to content

Instantly share code, notes, and snippets.

@justinkelly
Created January 6, 2011 09:43
Show Gist options
  • Save justinkelly/767714 to your computer and use it in GitHub Desktop.
Save justinkelly/767714 to your computer and use it in GitHub Desktop.
find the difference between 2 dates in days
<?php
function date_diff_in_days($from, $to = 'now')
{
$date1 = strtotime($from);
$date2 = strtotime($to);
$dateDiff = $date1 - $date2;
return floor($dateDiff/(60*60*24));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment