Bug #51613 [Opn->Bgs]: Ugly Error in date() and strtotime()
| From: | aharvey@php.net | Date: | Tue, 20 Apr 2010 09:24:44 +0000 |
| Subject: | Bug #51613 [Opn->Bgs]: Ugly Error in date() and strtotime() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-149721@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51613&edit=1
ID: 51613
Updated by: aharvey@php.net
Reported by: contact at vladrotariu dot com
Summary: Ugly Error in date() and strtotime()
-Status: Open
+Status: Bogus
Type: Bug
Package: Date/time related
Operating System: Ubuntu 9.10
PHP Version: 5.3.2
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.
Previous Comments:
------------------------------------------------------------------------
[2010-04-20 11:22:20] contact at vladrotariu dot com
Description:
------------
When you try to create a succession of months using the following code,
you will notice a very ugly bug that results in skipping months
Test script:
---------------
for(
$i = strtotime("2004-10-01" );
$i <= mktime();
$i += (24*60*60 * cal_days_in_month( CAL_GREGORIAN, date("m", $i),
date("Y", $i) ))
) {
$year_month = date("Ymd H:i:s", $i);
echo "<br />".$year_month;
}
Expected result:
----------------
20041001 00:00:00
20041101 00:00:00
20041201 00:00:00
Actual result:
--------------
20041001 00:00:00
20041031 23:00:00
20041201 23:00:00
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51613&edit=1