ID: 35043 Updated by: [EMAIL PROTECTED] Reported By: daniel at septum dot org -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Linux 2.4 PHP Version: 6CVS-2005-11-01 (snap) New Comment:
We are happy to tell you that you just discovered Daylight Savings Time. For more information see: http://webexhibits.org/daylightsaving/b.html Instead of using mktime/date consider using gmmktime and gmdate which do not suffer from DST. . Previous Comments: ------------------------------------------------------------------------ [2005-11-01 10:58:41] daniel at septum dot org Description: ------------ When involving the 31st of October (either by finding out number of days between 2005-10-29 and 2005-10-31 or 2005-10-31 and 2005-11-01), it gives the wrong result. Days between 2005-10-29 and 2005-10-30 returns 1 (which is correct), however, days between 2005-10-29 and 2005-10-31 returns 3 (which is incorrect, it should be 2). It seems to work fine for 2001, 2002, 2003 and 2006-2009, not for 2004 and 2005 (as stated above). Reproduce code: --------------- $dos = "2005-10-30"; $year = substr($dos, 0, 4); $month = substr($dos, 5, 2); $day = substr($dos, 8, 2); $mktime_dos = mktime(0, 0, 0, $month, $day, $year); $next_month = "2005-11-01"; $year = substr($next_month, 0, 4); $month = substr($next_month, 5, 2); $day = substr($next_month, 8, 2); $mktime_now = mktime(0, 0, 0, $month, $day, $year); $difference = $mktime_now - $mktime_dos; $signed_up_days_ago = ceil($difference / 60 / 60 / 24); echo $signed_up_days_ago . "\n"; Expected result: ---------------- 2 Actual result: -------------- 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35043&edit=1