Revision: 39820
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 21, 2011 08:11 by klovera
Initial Code
function dateDiff($beginDate, $endDate) { $fromDate = date('Y-n-j',strtotime($beginDate)); $toDate = date('Y-n-j',strtotime($endDate)); $date_parts1=explode('-', $beginDate); $date_parts2=explode('-', $endDate); $start_date=gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]); $end_date=gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]); return $end_date - $start_date; }
Initial URL
http://www.klovera.com/php-subtract-dates/
Initial Description
// example <br> $from = '2011-1-6'; <br> $to = '2011-1-8'; <br> dateDiff($from,$to); // returns 2
Initial Title
Number of days between 2 dates
Initial Tags
php
Initial Language
PHP