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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu May 09 23:01:32 2024 UTC