Re: mktime fails for pre 1970 on Fedora 3



>I have a client's website running on Linux at www.dsvr.co.uk, a well
>respected hosting company, and PHP's mktime() as on many Linux versions
>still can't handle dates prior to 1970. This is madness. Can anyone explain
>why the problem with mktime()'s dependence on glibc STILL hasn't been
>addressed as of PHP 5? I can't believe the PHP developers continute to keep
>their head in the sand with regard to mktime() and it's problems dealing
>with dates prior to 1970. It's no good blaming glibc. If glibc is
>problematic dependence on it should have been dropped long ago. Perl's
>Date::Calc doesn't suffer from these problems.

I wish PHP had a date representation OTHER than a unix timestamp
for date calculations. Pretty much all of the date/time functions
are limited by this. Of course, changing this is going to be a
problem because there are undoubtedly lots of scripts that store
that representation in files or databases. A 32-bit Unix timestamp
is limited to 1970 - 2038 for the "positive" range, and depending
on whether it's considered signed or unsigned, to 1901-1969 or
2038-2106 for the part with the high bit set.

MySQL uses a text representation of the form: 2005-11-28 15:01:38.
It has potential Y10K problems, but most of the date/time functions
other than the couple which input or output a unix timestamp are
not limited to a couple of centuries. Functions like adding x
seconds to a timestamp are, however, much more complicated and
there's a lot of functionality I'd like to see that isn't implemented.

I prefer to use MySQL's date math where the date involved isn't
tied to something like a file stamp. For example, a UNIX timestamp
is hopeless for birth dates or expected retirement dates.

Gordon L. Burditt
.



Relevant Pages

  • Re: strtotime and dates long long ago ...
    ... > mktime returns a unix timestamp which is only good for dates between 1970 ... > and 2038 on Windows and Linux. ...
    (comp.lang.php)
  • Re: mktime trouble
    ... m = Numeric representation of a month, with leading zeros ... > parse with PHP (i.e., ... > stranger, when I change the month field in mktime to 9, like so: ... > It works the same way if I feed date a Unix timestamp, ...
    (php.general)
  • mktime trouble
    ... parse with PHP (i.e., a unix timestamp. ... stranger, when I change the month field in mktime to 9, like so: ... It works the same way if I feed date a Unix timestamp, ... Peter Torraca ...
    (php.general)
  • mktime question
    ... I understand that mktime will convert a date to a unix timestamp: ... but if my dates are this format: ... Switch statements? ...
    (comp.lang.php)