#40804 [Opn->Bgs]: strtotime returning bad dates (last <day>)
| From: | derick@php.net | Date: | Wed, 14 Mar 2007 16:55:00 +0000 |
| Subject: | #40804 [Opn->Bgs]: strtotime returning bad dates (last <day>) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-110342@lists.php.net to get a copy of this message | ||
ID: 40804
Updated by: derick@php.net
Reported By: zirephoenix at rogers dot com
-Status: Open
+Status: Bogus
Bug Type: Date/time related
PHP Version: 4.4.6
New Comment:
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which
do
not suffer from DST.
Add the time to your example code to show what really happens.
Previous Comments:
------------------------------------------------------------------------
[2007-03-14 16:52:27] zirephoenix at rogers dot com
Description:
------------
My hosting told me to post the bug here instead of asking them to
figure it out. They recently upgraded to 4.4.6 and the strtotime
function started returning bad dates for some of the "last <day>"
strings.
The code below should show a continuous list of dates, but it doesn't.
It seems to break from last week of today to last sunday.
Reproduce code:
---------------
<html>
<body>
<?php
echo date("F d, Y", strtotime("last sunday")) . "<br>\n";
echo date("F d, Y", strtotime("last monday")) . "<br>\n";
echo date("F d, Y", strtotime("last tuesday")) . "<br>\n";
echo date("F d, Y", strtotime("last wednesday")) . "<br>\n";
echo date("F d, Y", strtotime("last thursday")) . "<br>\n";
echo date("F d, Y", strtotime("last friday")) . "<br>\n";
echo date("F d, Y", strtotime("last saturday")) . "<br>\n";
?>
</body>
</html>
Expected result:
----------------
March 11, 2007
March 12, 2007
March 13, 2007
March 07, 2007
March 08, 2007
March 09, 2007
March 10, 2007
Actual result:
--------------
March 10, 2007
March 12, 2007
March 13, 2007
March 06, 2007
March 07, 2007
March 08, 2007
March 09, 2007
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40804&edit=1