#16429 [Com]: strtotime fails when crossing Daylight Saving Time
| From: | ilia at prohost dot org | Date: | Thu, 22 Aug 2002 16:42:40 +0000 |
| Subject: | #16429 [Com]: strtotime fails when crossing Daylight Saving Time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-17572@lists.php.net to get a copy of this message | ||
ID: 16429
Comment by: ilia@prohost.org
Reported By: sveinp@basefarm.no
Status: Verified
Bug Type: Date/time related
Operating System: Solaris/Linux
PHP Version: 4.3.0-dev
New Comment:
After a few more tests I was able to replicate the problem, it appears
that if I set the date higher then the date on which the change occurs,
the functions messes up.
For example:
<?php
$today = mktime(9, 28, 0, 4, 8, 2002);
print date("r", $today) . "\n";
print date("r", strtotime("last saturday", $today)) . "\n";
?>
------------
Mon, 8 Apr 2002 09:28:00 -0400
Fri, 5 Apr 2002 23:00:00 -0500
Previous Comments:
------------------------------------------------------------------------
[2002-08-22 12:39:00] ilia@prohost.org
<?php
$today = mktime(9, 28, 0, 4, 7, 2002);
print date("r", $today) . "\n";
print date("r", strtotime("last saturday", $today)) . "\n";
?>
------------
Sun, 7 Apr 2002 09:28:00 -0400
Sat, 6 Apr 2002 00:00:00 -0500
Seems to work fine, even across DST.
------------------------------------------------------------------------
[2002-08-19 19:07:22] msopacua@idg.nl
Rasmus, Ilia.
Please look at your results: The timezone is the same, as there was no
DST jump in that weekend for you.
http://www.timeanddate.com/time/dstevents.html
Please try for one week later.
------------------------------------------------------------------------
[2002-08-19 17:25:06] ilia@prohost.org
Works fine for me as well, with PHP 4.3.0-dev <1 hour old
Thu, 4 Apr 2002 09:28:00 -0500
Sat, 30 Mar 2002 00:00:00 -0500
------------------------------------------------------------------------
[2002-08-19 17:22:12] rasmus@php.net
Works for me. I get:
Thu, 4 Apr 2002 09:28:00 -0800
Sat, 30 Mar 2002 00:00:00 -0800
------------------------------------------------------------------------
[2002-08-19 17:18:54] sniper@php.net
Oops..the original script by sveinp@basefarm.no works now..but the
example by msopacua@idg.nl does not..
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/16429
--
Edit this bug report at http://bugs.php.net/?id=16429&edit=1