> $date1 = "10/12/2002";
> $date1 = date("D M j Y", strtotime($date1));
> $date2 = date("D M j Y");
> $date3 = date("D M j Y", $date1);
> print $date1."<br>";
> print $date2."<br>";
> print $date3."<br>";
> The code above gives me the following output:
> Fri Oct 11 2002
> Mon Feb 4 2002
> Wed Dec 31 1969
> Is the strtotime() function causing this problem?
=yes, in a way. Please RTFM:
strtotime -- Parse about any English textual datetime description into a UNIX timestamp
The function expects to be given a string containing an English date
format and will try to parse that format into a UNIX timestamp relative
to the timestamp given in now, or the current time
if none is supplied. Upon failure, -1 is returned.
=The -1 explains $date3, it also enables you to back-track to an issue with $date1.
=If you are in America, what does 10/12 mean?
=If you are in Europe, what does 10/12 mean?
=Thus, how can strtotime() attempt to determine the meaning of the textual date?
(I'll send you the full lecture if you have no idea what I'm talking about)
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php