Skip to content

Instantly share code, notes, and snippets.

@crishnakh
Created January 12, 2013 13:13
Show Gist options
  • Save crishnakh/4518055 to your computer and use it in GitHub Desktop.
Save crishnakh/4518055 to your computer and use it in GitHub Desktop.
Resta fechas en PHP Formato YYYY-MM-DD
<?php
function restafechas($startDate,$endDate){
list($year, $month, $day) = explode("-", $startDate);
$startDate = mktime(0, 0, 0, $month, $day, $year);
list($year, $month, $day) = explode("-", $endDate);
$endDate = mktime(0, 0, 0, $month, $day, $year);
$totalDays = ($endDate - $startDate)/(60 * 60 * 24);
return $totalDays;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment