ID:               30190
 User updated by:  mike dot deeks at equest dot com
 Reported By:      mike dot deeks at equest dot com
 Status:           Wont fix
 Bug Type:         Date/time related
 Operating System: Debian, Linux
 PHP Version:      4.3.8
 Assigned To:      derick
 New Comment:

Ok, I understand. It is easy enough to work around anyway.

Thanks for taking a look.


Previous Comments:
------------------------------------------------------------------------

[2004-11-15 18:58:26] [EMAIL PROTECTED]

The parser in PHP 4 does not distinguish between "0" , "00", "000" or
"0000" and this can not be solved easily. The new parser for PHP 5 will
be able to handle the year 0 correctly as an error.

------------------------------------------------------------------------

[2004-09-22 03:24:15] mike dot deeks at equest dot com

Correction. Expected Results should read:

Expected result:
----------------
946713600
946627200
943948800
-1

------------------------------------------------------------------------

[2004-09-22 03:18:54] mike dot deeks at equest dot com

Description:
------------
strtotime returns the date 1999-11-31 (Timestamp: 943948800) instead of
-1 when I pass it "0000-00-00".

>From what I can tell, it assumes 0000 is the year 2000. Then the 00
month and 00 day refer to the previous month and the previous day from
the year 2000. i.e. "2000-01-01" minus one month, and one day.

Should it not return a -1 because that is an invalid time?

"0000-00-00" is what MySQL defaults invalid DATE values to by the way.

Reproduce code:
---------------
echo strtotime("2000-01-01") . "/n";
echo strtotime("2000-01-00") . "/n";
echo strtotime("2000-00-00") . "/n";
echo strtotime("0000-00-00") . "/n";

Expected result:
----------------
946713600
946627200
-1
-1

Actual result:
--------------
946713600
946627200
943948800
943948800


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30190&edit=1

Reply via email to