Torben,

> > toni,
> >
> > > $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)
>
> No offense, but in TFM (which you have of course R), follow the 'Date
> Input Formats' link to:
>
>    http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html
>
> You will find this sentence:
>
>    The construct 'month/day/year', popular in the United States, is
>    accepted.
>
> In other words, '10/12/2002' should work fine with strtotime(). The
> problem is elsewhere.


=One thing for sure, I'm not going to get into an argument with the guy who may well 
have written that very part
of the manual !

=The -1 is the key indicator.

=Rather than majoring on the manual, I was working on Toni's email address (which told 
me very little) and the
fact that she is on the US Pacific Coast. In other words, her server time zone (which 
affects the way data
functions work) is likely subject to Summer Time discontinuities. This combined with 
the date being converted
back and forth with datetime formats, crosses the from one day to the other.

=Regards,
=dn


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to