|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-06-03 10:52 UTC] post at oliver-schieche dot de
Description: ------------ Trying to get mktime to create a timestamp for today at 00:00 hours, odd results are returned. Previous versions of PHP 5 returned a correct timestamp even without adding 1900 to the year. This change to mktime behavior was not documented in the ChangeLog. Reproduce code: --------------- $v = localtime(time(), TRUE); $tm1 = mktime(0, 0, 0, $v['tm_mon']+1, $v['tm_mday'], $v['tm_year']); $tm2 = mktime(0, 0, 0); Expected result: ---------------- tm1 == tm2 == 1243980000 // 2009-06-03 00:00:00 Actual result: -------------- tm1 = -58714246800 tm2 = 1243980000 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 01:00:01 2025 UTC |
I know that years returned from localtime() start with 1900. But the problem with mktime still remains. for PHP 5.2.6 mktime(0,0,0,6,3,109) returns 1243980000 and the large negative number will be returned for the exact same call to mktime() in PHP 5.2.9