an other issue with daylight-saveing in days_between solved, now the calculation is down ignoring the daylight-saveing

This commit is contained in:
Ralf Becker 2003-03-18 18:02:36 +00:00
parent c280a1ab7e
commit 4d4f86af2b

View File

@ -427,10 +427,11 @@
@abstract Get the number of days between two dates @abstract Get the number of days between two dates
@author Steven Cramer/Ralf Becker @author Steven Cramer/Ralf Becker
@param $m1 - Month_1, $d1 - Day_1, $y1 - Year_1, $m2 - Month_2, $d2 - Day_2, $y2 - Year_2 @param $m1 - Month_1, $d1 - Day_1, $y1 - Year_1, $m2 - Month_2, $d2 - Day_2, $y2 - Year_2
@note the last param == 0, ensures that the calculation is always done without daylight-saveing
*/ */
function days_between($m1,$d1,$y1,$m2,$d2,$y2) function days_between($m1,$d1,$y1,$m2,$d2,$y2)
{ {
return intval((mktime(0,0,0,$m2,$d2,$y2) - mktime(0,0,0,$m1,$d1,$y1)) / 86400); return intval((mktime(0,0,0,$m2,$d2,$y2,0) - mktime(0,0,0,$m1,$d1,$y1,0)) / 86400);
} }
function date_compare($a_year,$a_month,$a_day,$b_year,$b_month,$b_day) function date_compare($a_year,$a_month,$a_day,$b_year,$b_month,$b_day)