ID: 33871
User updated by: jeremy at techtrav dot com
Reported By: jeremy at techtrav dot com
-Status: Feedback
+Status: Open
Bug Type: Date/time related
Operating System: Windows XP Apache 2
PHP Version: 5.1.0b3
New Comment:
I have upgraded to the newest snap as you have requested and I am still
getting the same results. PHP 5.0.4 returns the correct time. PHP
5.1.X returns the wrong time. Could this be an operating system issue?
I am on Windows XP with Apache 2.
Previous Comments:
------------------------------------------------------------------------
[2005-07-26 18:05:51] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip>you get the expected result:
No, *I* get the expected result with both versions.
------------------------------------------------------------------------
[2005-07-26 18:02:13] jeremy at techtrav dot com
you get the expected result:
string(19) "10/30/2005 23:10:00" string(19) "10/31/2005 00:10:00"
However in PHP 5.1.X I get:
string(19) "10/31/2005 00:10:00" string(19) "10/31/2005 00:10:00"
Which is wrong.
------------------------------------------------------------------------
[2005-07-26 17:56:24] tony2001@php.net
Please run this code with 5.0.4 and tell me what you get:
<?php
$date = strtotime('25 Oct');
var_dump(date('m/d/Y H:m:s', $date+(86400*6)));
var_dump(date('m/d/Y H:m:s', strtotime("+6 days", $date)));
?>
------------------------------------------------------------------------
[2005-07-26 17:53:48] jeremy at techtrav dot com
Actually I realize 86400*6 should not be right as my code displays
below. It should give you back one hour short, however when I do add
86400*6 onto the day in PHP 5.1.X I am getting the exact 6 days out.
That would be a problem. Again PHP 5.0.4 handles this correctly.
------------------------------------------------------------------------
[2005-07-26 17:49:24] tony2001@php.net
Obviosly "6 days" is not equal to "86400*6", exactly because of
daylight savings.
Change this line:
echo date('m/d/Y H:m:s', $date+(86400*6));
to
echo date('m/d/Y H:m:s', strtotime("+6 days", $date));
------------------------------------------------------------------------
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/33871--
Edit this bug report at http://bugs.php.net/?id=33871&edit=1