php.net |  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
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: mrobertson at hotmail dot com
New email:
PHP Version: OS:

 

 [2006-09-08 19:44 UTC] mrobertson at hotmail dot com
Description:
------------
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-08 19:48 UTC] tony2001@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: Thu Mar 13 21:01:32 2025 UTC