Bug #60970 [Opn->Nab]: Wrong calculation of date() function from epoch
| From: | derick@php.net | Date: | Fri, 03 Feb 2012 13:56:55 +0000 |
| Subject: | Bug #60970 [Opn->Nab]: Wrong calculation of date() function from epoch | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-167107@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=60970&edit=1
ID: 60970
Updated by: derick@php.net
Reported by: gdarcan at gmail dot com
Summary: Wrong calculation of date() function from epoch
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: both Win7-64b and FreeBSD amd64
PHP Version: 5.3.10
Block user comment: N
Private report: N
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:
------------------------------------------------------------------------
[2012-02-03 13:51:13] gdarcan at gmail dot com
Description:
------------
After 2011-10-30 03:59:59, there should be 2011-10-30 04:00:00
there should not be 2011-10-30 03:00:00
Test script:
---------------
<?php
$t1 = "1319936371";
for ($i=0;$i<100;$i++) {
$t = $t1+$i;
echo date("Y-m-d H:i:s", $t)."<br>";
}
?>
Expected result:
----------------
...
...
1319936397 2011-10-30 03:59:57
1319936398 2011-10-30 03:59:58
1319936399 2011-10-30 03:59:59
1319936400 2011-10-30 04:00:00
1319936401 2011-10-30 04:00:01
1319936402 2011-10-30 04:00:02
...
...
Actual result:
--------------
...
...
1319936397 2011-10-30 03:59:57
1319936398 2011-10-30 03:59:58
1319936399 2011-10-30 03:59:59
1319936400 2011-10-30 03:00:00
1319936401 2011-10-30 03:00:01
1319936402 2011-10-30 03:00:02
...
...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60970&edit=1