#19165 [Opn->Dup]: strtotime does not return -1 on some invalid dates

From: Date: Thu, 29 Aug 2002 07:47:35 +0000
Subject: #19165 [Opn->Dup]: strtotime does not return -1 on some invalid dates
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-18128@lists.php.net to get a copy of this message
ID: 19165 Updated by: derick@php.net Reported By: jc@mega-bucks.co.jp -Status: Open +Status: Duplicate Bug Type: Date/time related Operating System: Red Hat Linux 7.2 PHP Version: 4.2.2 New Comment: I'm marking this as duplicate of 19166, because IMO this is a documentation problem rather than a problem in the code. Derick Previous Comments: ------------------------------------------------------------------------ [2002-08-29 03:43:03] jc@mega-bucks.co.jp This code shows that strtotime does not recognize some dates that are in the correct format but invalid: $bod = "1970-1-222"; echo "I think that $bod is timestamp " . strtotime($bod) . "<BR>"; echo "and that would be " . date("Y-n-d",strtotime($bod)). "<BR>"; The output is: I think that 1970-1-222 is timestamp 19062000 and that would be 1970-8-10 The documentation says that strtotime should report -1 on a failure. Shouldn't this be a failure? Jc ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19165&edit=1

« previous php.bugs (#18128) next »