#18769 [Bgs]: strtotime('00:01am'); returns -1 instead of timestamp

From: Date: Wed, 07 Aug 2002 08:27:35 +0000
Subject: #18769 [Bgs]: strtotime('00:01am'); returns -1 instead of timestamp
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16126@lists.php.net to get a copy of this message
ID: 18769 User updated by: peka@yashuu.de Reported By: peka@yashuu.de Status: Bogus Bug Type: Date/time related Operating System: Tested on Windows2000 / Unix PHP Version: 4.2.2 New Comment: So maybe there should be 2 different error states? one for unrecogniseable string one for recognised string, but incorrect time-format If those two could be distinguished Previous Comments: ------------------------------------------------------------------------ [2002-08-07 04:18:16] eru@php.net This is quite correct, as 0 isn't a valid hour in this time-format. To quote from date input formats: If the time is followed by am' or pm' (or a.m.' or p.m.'), hour is restricted to run from 1 to 12, and `:minute' may be omitted (taken to be zero). am' indicates the first half of the day, pm' indicates the second half of the day. In this notation, 12 is the predecessor of 1: midnight is 12am' while noon is 12pm'. See http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html ------------------------------------------------------------------------ [2002-08-07 04:01:10] peka@yashuu.de The PHP code <? echo strtotime('00:01am'); ?> produces -1 as return instead of a correct timestamp I tested on W2k/Apache/PHP 4.2.2, afterwards uploading it to my webspace provider who uses Unix. The bug is reproduceable there, too. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18769&edit=1

« previous php.bugs (#16126) next »