ID:               30532
 Comment by:       jack dot littleton at gmail dot com
 Reported By:      rbro at hotmail dot com
 Status:           Open
 Bug Type:         Date/time related
 Operating System: Linux
 PHP Version:      4.3.9
 New Comment:

I've recently experienced this same problem in the following way:

On Friday, October 29, 2004 I sent strtotime the value ('Monday'),
should have returned the data for Monday, November 1, 2004, but instead
returned Sunday, October 31, 2004.  I have never had a similar problem
with strtotime when the span of the current time to the target time did
NOT cross the daylight savings time boundary.

(Further: this was on Windows XP SP1 using Apache 2 and PHP 4.3.5)


Previous Comments:
------------------------------------------------------------------------

[2004-10-22 22:32:27] rbro at hotmail dot com

Further information: The following script does give the expected
results:

<?php
echo date('Y-m-d H:i:s', strtotime('+1 hour',
strtotime('2004-10-31')))."\n";
echo date('Y-m-d H:i:s', strtotime('+2 hours',
strtotime('2004-10-31')))."\n";
echo date('Y-m-d H:i:s', strtotime('+3 hours',
strtotime('2004-10-31')))."\n";
?>

of 

2004-10-31 01:00:00
2004-10-31 01:00:00
2004-10-31 02:00:00

So now I believe the issue is that the following 2 statements give
different output though they should have the same output:

<?php
echo strtotime('2004-10-31 +2 hours')."\n";
echo strtotime('+2 hours', strtotime('2004-10-31'))."\n";
?>

------------------------------------------------------------------------

[2004-10-22 17:33:21] rbro at hotmail dot com

Description:
------------
In the US, Daylight Savings Time ends on October 31, 2004 at 2am where
clocks are then reset back to 1am.  I am in the Eastern time zone.  If
I run the following script where I'm adding 1 hour, 2 hours, and 3
hours to the date 2004-10-31, I'm getting different results from
including EDT in the date or not, when I thought that strtotime()
defaults to the local timezone.

Reproduce code:
---------------
<?php
echo date('Y-m-d H:i:s', strtotime('2004-10-31 EDT +1 hour'))."\n";
echo date('Y-m-d H:i:s', strtotime('2004-10-31 EDT +2 hours'))."\n";
echo date('Y-m-d H:i:s', strtotime('2004-10-31 EDT +3 hours'))."\n";

echo "\n";

echo date('Y-m-d H:i:s', strtotime('2004-10-31 +1 hour'))."\n";
echo date('Y-m-d H:i:s', strtotime('2004-10-31 +2 hours'))."\n";
echo date('Y-m-d H:i:s', strtotime('2004-10-31 +3 hours'))."\n";
?>


Expected result:
----------------
2004-10-31 01:00:00
2004-10-31 01:00:00
2004-10-31 02:00:00

2004-10-31 01:00:00
2004-10-31 01:00:00
2004-10-31 02:00:00

Actual result:
--------------
2004-10-31 01:00:00
2004-10-31 01:00:00
2004-10-31 02:00:00

2004-10-31 01:00:00
2004-10-31 02:00:00
2004-10-31 03:00:00



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30532&edit=1

Reply via email to