|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-09-22 03:24 UTC] mike dot deeks at equest dot com
[2004-11-15 18:58 UTC] derick@php.net
[2004-11-15 20:17 UTC] mike dot deeks at equest dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 23:00:01 2025 UTC |
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