#51081 [Opn]: date("g:ia",strtotime("24:00")) returns 1:00am
| From: | degeberg@php.net | Date: | Thu, 18 Feb 2010 14:02:10 +0000 |
| Subject: | #51081 [Opn]: date("g:ia",strtotime("24:00")) returns 1:00am | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-147823@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: Open
-Bug Type: Documentation problem
+Bug Type: Date/time related
Operating System: Windows Vista
PHP Version: 5.2.12
New Comment:
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
====================
Previous Comments:
------------------------------------------------------------------------
[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