Y2K38

at 2010-08-25 in Further reading by friebe (0 comments)

In a recent Sitepoint article, the author talks about problems with PHP's strtotime() function, which can be basically summed up to this:

  $ xp -e 'Console::writeLine(date("l d F Y H:i", strtotime("2040-02-01")));'
Thursday 01 January 1970 01:00
The problem is the internal representation of dates, which will overflow and thus cause strtotime() to yield an incorrect value.

The XP Framework's util.Date class, being based on PHP's DateTime class, will not exhibit this problem, regardless of whether the system is 32-bit or 64-bit.
  $d= new Date('2040-02-01'); 
Console::writeLine
($d->toString('l d F Y H:i')); // Wednesday 01 February 2040 00:00
See also http://en.wikipedia.org/wiki/Year_2038_problem and - with a humouristic take: http://xkcd.com/607/



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases
5.8-SERIES
Unicode
Language
5.9-SERIES

Related

Find related articles by a search for «Y2K38».