php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38994 bugs in mktime() - easy to confirm
Submitted: 2006-09-29 15:12 UTC Modified: 2006-09-29 15:15 UTC
From: naox at yum dot pl Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.1.6 OS: centos 4
Private report: No CVE-ID: None
 [2006-09-29 15:12 UTC] naox at yum dot pl
Description:
------------
there is problem with mktime. it caclulates badly seconds in pedroids 27-28 march in some years like 2005. Possibly some other pedroids are affected. this is just example to make bug search easier.

Reproduce code:
---------------
<?
$a1 = mktime(0,0,0,3,27,2005);
$a2 = mktime(0,0,0,3,28,2005);
$w = ($a2 - $a1) / 60 / 60 / 24;
echo $w;

echo "<br>\n";

$a1 = mktime(0,0,0,3,27,2006);
$a2 = mktime(0,0,0,3,28,2006);
$w = ($a2 - $a1) / 60 / 60 / 24;
echo $w;

?>

Expected result:
----------------
1
1

Actual result:
--------------
will show:
0.95833333333333
1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-29 15:15 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 Jul 17 14:04:04 2025 UTC