Edit report at https://bugs.php.net/bug.php?id=62364&edit=1
ID: 62364 Updated by: der...@php.net Reported by: praflo at gmail dot com Summary: Strange behaviour in mktime() function using leading zeros -Status: Open +Status: Not a bug Type: Bug Package: Date/time related Operating System: gentoo linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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 Numbers starting with a 0 are octal numbers. 08 is an invalid octal number and turns into 0. Previous Comments: ------------------------------------------------------------------------ [2012-06-19 09:52:55] praflo at gmail dot com Description: ------------ In the mktime() function if you add a "0" before the number of the month of August or September (eg. august -> 08) the result is something wrong. See example below. It seems this happens only with "08" and "09", not with "07", "06", etc. I discovered this because August 12th 2012 (08-12-2012) is the last day of the next Olympic games in London. Hope this helps bye gian (PHP version: PHP 5.3.8-pl0-gentoo) Test script: --------------- <?php $timestamp1 = mktime(23,59,59,08,12,2012); $timestamp2 = mktime(23,59,59, 8,12,2012); $out1 = date("m-d-Y H:i:s",$timestamp1); $out2 = date("m-d-Y H:i:s",$timestamp2); echo "DATE1 is : $out1\n"; echo "DATE2 is : $out2\n"; /* output is: DATE1 is : 12-12-2011 23:59:59 <---- IT SAYS DEC 12 2011 !!! DATE2 is : 08-12-2012 23:59:59 */ ?> Expected result: ---------------- DATE1 is : 08-12-2012 23:59:59 DATE2 is : 08-12-2012 23:59:59 Actual result: -------------- DATE1 is : 12-12-2011 23:59:59 DATE2 is : 08-12-2012 23:59:59 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62364&edit=1