ID: 51081 User updated by: mike dot turpin at gmail dot com Reported By: mike dot turpin at gmail dot com Status: Open Bug Type: Date/time related Operating System: Windows Vista PHP Version: 5.2.12 New Comment:
I did originally point out the problem as a suspected documentation bug. Could the documentation point out this? Previous Comments: ------------------------------------------------------------------------ [2010-02-18 14:14:28] mike dot turpin at gmail dot com -Status: Bogus +Status: Open Just to point out that I actually found this in version 5.2.11 but don't want to upgrade yet as my web host uses this version. ------------------------------------------------------------------------ [2010-02-18 14:14:11] der...@php.net -Status: Open +Status: Bogus This is not a bug, the following happens in 5.2: strtotime( "24:00" ) returns "false" (because 24:00 is not supported) date() uses an integer representation of false (0) and then formats it using the current timezone: php -r 'echo date(DateTime::ISO8601 . " e", 0), "\n";' 1970-01-01T01:00:00+0100 Europe/London (Yes, on Jan 1st 1970, London had an offset of UTC+1, search for "British Standard Time Act 1968 (1968 c. 45)" at http://www.srcf.ucam.org/~jsm28/british-time/) In PHP 5,3, "24:00" is supported and the following happens: der...@kossu:~$ php -r 'echo strtotime("24:00");' 1266537600 der...@kossu:~$ php -r 'echo date(DateTime::ISO8601 . " e", 1266537600), "\n";' 2010-02-19T00:00:00+0000 Europe/London ------------------------------------------------------------------------ [2010-02-18 14:02:10] degeb...@php.net -Bug Type: Documentation problem +Bug Type: Date/time related Seems to be a bug in the 5.2 branch. Reclassifying. ==================== dan...@daniel-laptop:~$ php -r 'echo phpversion().PHP_EOL.date("g:ia",strtotime("24:00")).PHP_EOL;' 5.3.1 12:00am dan...@daniel-laptop:~$ ~/src/php-5.2.12/sapi/cli/php -r 'echo phpversion().PHP_EOL.date("g:ia",strtotime("24:00")).PHP_EOL;' 5.2.12 1:00am ==================== ------------------------------------------------------------------------ [2010-02-18 13:47:03] mike dot turpin at gmail dot com Description: ------------ I suspect that this is a documentation problem in strtotime rather than a bug, but I think it should be pointed out in the doc as it's easy to fall into the trap. strtotime("24:00") returns false If you then have: date("g:ia",strtotime("24:00")) You will get 1:00am but might be expecting 12:00am ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=51081&edit=1