Re: Bug #2424 Updated: date() function missing a day after Oct. 31, 1999
| From: | ron at rlt dot com | Date: | Sun, 03 Oct 1999 02:22:27 +0000 |
| Subject: | Re: Bug #2424 Updated: date() function missing a day after Oct. 31, 1999 | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-11452@lists.php.net to get a copy of this message | ||
Thank you!
I thought about daylight savings time, but I didn't think that one hour
could cause a difference of a whole day. I failed to consider the effect
of that hour falling on midnight.
Perhaps relying on the out-of-range feature of mktime() would be safer.
..., mktime(0,0,0,10,315,1999), mktime(0,0,0,10,322,1999), ...etc.
But this seems odd to me. I'll use your suggestion.
Thanks again,
-- Ron L. Toms
>
> 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
>