note 28905 added to function.date

From: Date: Mon, 27 Jan 2003 18:12:17 +0000
Subject: note 28905 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-42827@lists.php.net to get a copy of this message
Beware of the evil integer overflow. The following code will not work for dates older than December 14 1901 (and presumably some time in 2037). $date="1901-12-13"; // and older list($year,$month,$day) = split("-",$date); $time =mktime(0,0,0,$month,$day,$year); echo date("l F jS, Y",$time); I get "Wednesday December 31st, 1969" every time. Why? (I think) mktime() returns "-1" for dates that are before this which is the equivalent of EPOCH-1 when passed into the date() function. I'd assume that this problem isn't present on 64-bit hardware. Does anyone have a work around? Preferably one that doesn't involve rewriting the date function. -- http://www.php.net/manual/en/function.date.php http://master.php.net/manage/user-notes.php?action=edit+28905 http://master.php.net/manage/user-notes.php?action=delete+28905 http://master.php.net/manage/user-notes.php?action=reject+28905

« previous php.notes (#42827) next »