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

Correction. Expected Results should read:

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


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

[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