> I'm not sure that there's any problem with the documentation 
> (although it wouldn't hurt to mention it in the comments). 
> What is it about "0000-00-00 00:00:00" that makes it an 
> invalid date? (See Christian's explanation)

Zero values for month and day are NOT valid.  PHP treats them as valid,
but according to GNU (on whose requirements strtotime's parsing is
based, according to the docs), month values must be in the range of 1-12
and day values must be 1-31.

Come to think of it, I wonder how PHP handles something like
'2008-06-31' - does it treat that as July 1?  Or does it call it an
invalid date?  Seems like the same sort of behavior - should be
considered invalid, but I'm betting that PHP handles it transparently.

The upshot is that we can't actually rely on strtotime to determine
whether a string is a valid date/time.  The docs don't ever explicitly
say that the date strings themselves are checked for validity, but
returning false on "failure" implies to me that it will return false if
it can't get a *valid* date out of the string.

Jack

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to