ID:               27780
 User updated by:  Hua dot Qu at volvo dot com
 Reported By:      Hua dot Qu at volvo dot com
 Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Windows 2000
 PHP Version:      4.3.4
 New Comment:

Thank you for quickly reply.



I still consider it as a bug. If I set 



$to = “2004-03-28 00:00:00” 

$march0 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to"));

$march1 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 second"));

$march2 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 day "));



$march1 gives the correct result, while $march2 gives the wrong result.
Because during the midnight of 28th it changed from the wintertime to
the summertime for daylight saving. 



As you pointed out, to add a timezone:

$to = "2004-03-28 00:00:00 WET";                                

$march0 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to"));

$march1 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 seconds "));

$march2   = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 day "));



Relative to $march0, $march1 gives the correct output, but these two
outputs are not what I expected. $march2 is still totally wrong no
matter reference to which dates.



The point is, I think, PHP checks the output result with for daylight
saving, but not the original input date.



Regards,

Hua Qu


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

[2004-03-30 12:12:55] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You need to add timezone information to the original date. 

For example change your text time to "2004-06-01 00:00:00 

EST". 

 

The end result will be that strtotime($to) will be 1 

smaller then  strtotime("$to +1 seconds "), which is the 

correct output. 

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

[2004-03-30 10:52:02] Hua dot Qu at volvo dot com

Description:
------------
strtotime($tm + 1 xxx) always adds one more hour to the result, if the
result-time is in the summertime, no matter $tm is in the summertime or
not.



It is the same in PHP CVS (5.0.x-dev) Built On: Mar 30, 2004 14:30 GMT



I think it is the daylight-savings-time problem. Perhaps, $tm is not
checked if it is already in the daylight-savings-time. 



There are already some similar reports, but they did not get the point,
and the bug has not been corrected untill  Mar 30, 2004 14:30 GMT.



Reproduce code:
---------------
echo "I have get one hour too much!<br><br>";



$to = "2004-06-01 00:00:00";

echo strtotime($to)."<br>\n";

echo strtotime("$to +1 seconds ")."<br><br>\n";

                

$newtime1 = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 seconds
"));

$newtime2   = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 day "));



echo "$to <br>\n";

echo "+1 s= $newtime1<br>\n";

echo "+1day=$newtime2<br><br>\n";

                

$correct = strftime("%Y-%m-%d %H:%M:%S", strtotime("$to +1 second -1
hour"));

echo "correct: +1 s=$correct<br>";



Expected result:
----------------
If $tm is the summertime, strtotime($tm +1 day) should return 24 hours
more, not 25 hours more.



If $tm is the wintertime and result is in the summertime, it should
return one extra hour. 



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


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

Reply via email to