When you set the date to "0000-00-00", you start the following sequence:


   1. strtotime returns false, because "0000-00-00" isn't a date it can
   parse into a timestamp.
   2. date returns 1969, because it's not passed a valid timestamp and it
   works from December 31, 1969 for any invalid date.


On Thu, Jan 14, 2010 at 1:14 PM, John Taylor-Johnston <
john.taylor-johns...@cegepsherbrooke.qc.ca> wrote:

> Hello,
>
> In a mysql date() field, I set the default to "0000-00-00".
>
> Therefore, $mydata->birthday = "0000-00-00";
>
> But when I run this next line, $then = 1969.
>
> $then=date("Y", strtotime($mydata->birthday));
>
> Why 1969, and not 0 or nothing?
>
> If I  echo strtotime("0000-00-00");
>
> Nothing appears. So $then should be nothing?
>
> What is wrong with my logic?
>
> Thanks,
> John
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

Reply via email to