Skip to content

Instantly share code, notes, and snippets.

@reactormade
Created August 22, 2012 12:42
Show Gist options
  • Save reactormade/3425217 to your computer and use it in GitHub Desktop.
Save reactormade/3425217 to your computer and use it in GitHub Desktop.
PHP days between two dates
function days_between($day_i,$month_i,$year_i,$day_f,$month_f,$year_f){
$days_in_between = (mktime(0,0,0,$month_f,$day_f,$year_f) - mktime(0,0,0,$month_i,$day_i,$year_i))/86400;
return $days_in_between;
}
//If we want to calculate the days between 21/8/2009 and 1/9/2009 then
echo days_between(21,8,2009,1,9,2009);
//would give us 11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment