Page 1 of 1

fun with dates

Posted: Mon Jan 17, 2005 3:07 pm
by magicrobotmonkey
here's something that happens. why?

Code: Select all

//this is actually pulled from a mysql db, but a var_dump tells me its:
//string(19) "0000-00-00 00:00:00"
//so this is the same
$blankDate = "0000-00-00 00:00:00";

echo date("m-d-Y",strtotime($blankDate));

//prints 11-30-1999
//why? what's up with that date? its not the Start Date or anything?

Posted: Mon Jan 17, 2005 3:48 pm
by timvw
because you feed the function invalid data...

http://www.gnu.org/software/tar/manual/ ... tar_7.html

Posted: Mon Jan 17, 2005 3:50 pm
by magicrobotmonkey
or, in more detail, strtotime thinks like this:

0000 = 2000
00 = 2000 - 1 month or 12-1999
00 = 12-1999 - 1 day or 11-30-1999