[drupal-devel] date conversion
killesreiter at physik.uni-freiburg.de
Mon Jun 13 09:36:28 UTC 2005
On Mon, 13 Jun 2005, Gordon Heydon wrote:
> On Mon, 2005-06-13 at 06:59 +0200, Gerhard Killesreiter wrote:
> > On Mon, 13 Jun 2005, Gordon Heydon wrote:
> > > I was wondering if anyone knows of a decent method of converting dates
> > > from text to a time.
> > >
> > > I did look at strtotime() but it will not convert anything before Jan 1,
> > > 1970 which is a problem since it is going to be used for a date of birth
> > > field, and some people will be over 35.
> > Note: The valid range of a timestamp is typically from Fri, 13 Dec
> > 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the
> > dates that correspond to the minimum and maximum values for a
> > 32-bit signed integer.)
> > (from my version of the php manual entry for strtotime)
> > print strtotime("60 years ago");
> > gives me -774821398.
> Well that gives me on both my ubuntu and debian linux systems both give
> me -1, It does say on the php site that it is windows and some linux
He, that's annoying. I tested on Debian too, and it fails. My earlier test
was on a rather ancient SuSE distribution.
> So if I use strtotime('31 Dec 1969') I get a -1, If it was giving me the
> rangi that it would say it would me ok.
In the comments there is a safestrtotime() function that claims to support
negative timestamps. Haven't tried it, though.
More information about the drupal-devel