ID: 48458
User updated by: post at oliver-schieche dot de
Reported By: post at oliver-schieche dot de
Status: Bogus
Bug Type: Date/time related
Operating System: Debian 4 2.6.18-6-amd64
PHP Version: 5.2.9
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2009-06-03 10:56:51] [email protected]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
$v['tm_year'] contains the years since 1900.
------------------------------------------------------------------------
[2009-06-03 10:52:32] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48458&edit=1