Re: PHP 4.0 Bug #9998: mktime() calculation error - 25 hours in a day
| From: | David G. | Date: | Thu, 12 Apr 2001 00:57:37 +0000 |
| Subject: | Re: PHP 4.0 Bug #9998: mktime() calculation error - 25 hours in a day | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-51480@lists.php.net to get a copy of this message | ||
You've discovered a problem with daylight savings time, as the dates you
found are the end of DST (at least in the US) when we set our clocks back an
hour. I suspect you'll find 23 hour days in April.
-david
<beartales@earthlink.net> wrote in message
news:20010326170514.15800.qmail@php2.chek.com...
> From: beartales@earthlink.net
> Operating system: freebsd 4.2
> PHP version: 4.0.4pl1
> PHP Bug Type: Date/time related
> Bug description: mktime() calculation error - 25 hours in a day
>
> using mktime() one day per year has 25 hours in it
> if you substract one date from the previous day and divide
> by 3600 you should find there are 24 hours in that day.
> however, one day per year has 25 hours.
> so far i have found one day per year.
> and a different day every year.
>
> 10/29/2000 25 hours
> 10/28/2001 25 hours
> 10/27/2002 25 hours
>
> to reproduce the problem:
>
> (mktime(0,0,0,10,30,2000)-mktime(0,0,0,10,29,2000))/3600
>
> (mktime(0,0,0,10,29,2001)-mktime(0,0,0,10,28,2001))/3600
>
> (mktime(0,0,0,10,28,2002)-mktime(0,0,0,10,27,2002))/3600
>
> i found the problem because i was creating date ranges for
> the user and putting them into a database. if i add the
> number of days in a month to a date, i should then have the
> same numeric date in the new month. for instance convert
> 08/10/2001:
> $new_day = mktime(0,0,0,8,10,2001) + ( 31 * 86400 )
> ( 31 number of days in august )
> ( 86400 seconds in a day )
> convert back to date date("Y-m-d", $new_day )
> should and does = 09/10/2001
>
> i have now tried this on two different servers.
> one - PII 350 freebsd 4.2, apache 1.3.17, php 4.0.4pl1
> two - PIII 667 freebsd 4.2, apache 1.3.17, php 4.0.4pl1
>
> both return the same problem
>
> thanks for any insight
> James Lose 03/26/2001
>
>
> --
> Edit Bug report at: http://bugs.php.net/?id=9998&edit=1
>
>
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net
> For additional commands, e-mail: php-dev-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>