Bug #2424 Updated: date() function missing a day after Oct. 31, 1999

From: Date: Sun, 03 Oct 1999 01:09:27 +0000
Subject: Bug #2424 Updated: date() function missing a day after Oct. 31, 1999
Groups: php.dev 
Request: Send a blank email to php-dev+get-11447@lists.php.net to get a copy of this message
ID: 2424 Updated by: jah Reported By: Ron@RLT.COM Status: Closed Bug Type: Misbehaving function Assigned To: jah Comments: You have forgotten to consider the effects of daylight saving time. mktime()'s arguments are expressed in local time, and it returns the offset in seconds from epoch (Jan 1 1970 00:00:00 GMT). Let's take an example and assume that your local timezone is EST5EDT. On line 5, mktime returns 938836800. (We'll just forgot $daystillsat * $secinday, they are not relevant to the explanation). Note that this date falls inside the daylight savings time. Now, let's assume that the DST stops on the night between 30 and 31 Oct and all the clock are skewed one hour backward. This will result as Nov 6 1999 00:00:00 your local time being 941864400 seconds off from epoch. But, $shipdate has been increment 5 times by 604800 (seconds in a week) and is now just 941860800, which falls on the previous day at 23:00. Maybe you should use mktime(12,0,0,10,02,1999). The possibility of DST being 12 hours off from the normal time is enough small not to be considered... Full Bug description available at: http://bugs.php.net/?id=2424

« previous php.dev (#11447) next »