php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60970 Wrong calculation of date() function from epoch
Submitted: 2012-02-03 13:51 UTC Modified: 2012-02-03 13:56 UTC
From: gdarcan at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.10 OS: both Win7-64b and FreeBSD amd64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gdarcan at gmail dot com
New email:
PHP Version: OS:

 

 [2012-02-03 13:51 UTC] 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
...
...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-03 13:56 UTC] derick@php.net
-Status: Open +Status: Not a bug
 [2012-02-03 13:56 UTC] derick@php.net
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.

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jun 03 00:01:26 2025 UTC