#51081 [Asn->Csd]: date("g:ia",strtotime("24:00")) returns 1:00am

From: Date: Thu, 18 Feb 2010 14:26:01 +0000
Subject: #51081 [Asn->Csd]: date("g:ia",strtotime("24:00")) returns 1:00am
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3937@lists.php.net to get a copy of this message
ID: 51081 Updated by: degeberg@php.net Reported By: mike dot turpin at gmail dot com -Status: Assigned +Status: Closed Bug Type: Documentation problem Operating System: Windows Vista PHP Version: 5.2.12 Assigned To: degeberg New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2010-02-18 14:25:56] svn@php.net Automatic comment from SVN on behalf of degeberg Revision: http://svn.php.net/viewvc/?view=revision&revision=295237 Log: Fixed bug #51081. Documented that '24:00' is unsupported prior to 5.3.0. ------------------------------------------------------------------------ [2010-02-18 14:16:31] mike dot turpin at gmail dot com I did originally point out the problem as a suspected documentation bug. Could the documentation point out this? ------------------------------------------------------------------------ [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] derick@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: derick@kossu:~$ php -r 'echo strtotime("24:00");' 1266537600 derick@kossu:~$ php -r 'echo date(DateTime::ISO8601 . " e", 1266537600), "\n";' 2010-02-19T00:00:00+0000 Europe/London ------------------------------------------------------------------------ [2010-02-18 14:02:10] degeberg@php.net -Bug Type: Documentation problem +Bug Type: Date/time related Seems to be a bug in the 5.2 branch. Reclassifying. ==================== daniel@daniel-laptop:~$ php -r 'echo phpversion().PHP_EOL.date("g:ia",strtotime("24:00")).PHP_EOL;' 5.3.1 12:00am daniel@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 ==================== ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/51081 -- Edit this bug report at http://bugs.php.net/?id=51081&edit=1

« previous php.doc.bugs (#3937) next »