|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38754 1 minute conversion error
Submitted: 2006-09-08 19:44 UTC Modified: 2006-09-08 19:48 UTC
From: mrobertson at hotmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.6 OS: Mac OS X 10.4.7
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.
Block user comment
Status: Assign to:
Bug Type:
From: mrobertson at hotmail dot com
New email:
PHP Version: OS:


 [2006-09-08 19:44 UTC] mrobertson at hotmail dot com
There seems to be a 1 minute (3600 second) error in mktime

Reproduce code:
$onedayinsecs = 86400;
$timeS = mktime(0, 0, 0, 3, 26, 2006);
$timeS = $timeS + $onedayinsecs;
$dayS = mktime(0, 0, 0, 3, 27, 2006);
echo($timeS." - ".$dayS."<br/>");

Expected result:
The two values should be the same since we are adding 1 day in 
seconds to mktime value of 3/26/06 and getting the mktime 
value of 3/27/06.

Actual result:
1143417600 - 1143414000

The difference is 3600. Note if you start at 1/1/06 and go 
through all the days in the year totalling seconds in 
comparison to mktime this error exists between
3/27/06 and 10/29/06. From 30/10/06 the error corrects itself.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-08 19:48 UTC]
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
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: Sun May 26 19:01:30 2024 UTC