note 24171 added to function.mktime

From: Date: Thu, 08 Aug 2002 13:13:49 +0000
Subject: note 24171 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-34529@lists.php.net to get a copy of this message
In doing some Birthdate manipulations I came across the following anomoly: <? echo "this seems to work:<br>"; $vis='2002-01-22'; list($y,$m,$d)=explode("-",$vis); $thisv=date("M j, Y", mktime(0,0,0,intval($m), intval($d), intval($y))); echo "date $vis [$m/$d/$y] => $thisv<br>"; echo "<p>so does this:<br>"; $vis='1970-01-01'; list($y,$m,$d)=explode("-",$vis); $thisv=date("M j, Y",mktime(0,0,0,intval($m), intval($d), intval($y))); echo "date $vis [$m/$d/$y] => $thisv<br>"; echo "<p>SO... why not this?<br>"; $vis='1928-07-10'; list($y,$m,$d)=explode("-",$vis); $thisv=date("M j, Y",mktime(0,0,0,intval($m),intval($d),intval($y))); echo "date $vis [$m/$d/$y] => $thisv<br>"; echo "<p>or this?<br>"; $vis='1969-12-30'; list($y,$m,$d)=explode("-",$vis); $thisv=date("M j, Y",mktime(0,0,0,intval($m), intval($d), intval($y))); echo "date $vis [$m/$d/$y] => $thisv<br>"; ?> with the following output: this seems to work: date 2002-01-22 [01/22/2002] => Jan 22, 2002 and this? date 1970-01-01 [01/01/1970] => Jan 1, 1970 SO... why not this? date 1928-07-10 [07/10/1928] => Dec 31, 1969 or this? date 1969-12-30 [12/30/1969] => Dec 31, 1969 ----------- it seems mktime() cannot handle dates earlier than dec 31, 1969? Has anyone else noticed this? This seems to me a pretty serious bug! I am using PHP V4.1.2 if that makes a difference. -- http://www.php.net/manual/en/function.mktime.php http://master.php.net/manage/user-notes.php?action=edit+24171 http://master.php.net/manage/user-notes.php?action=delete+24171 http://master.php.net/manage/user-notes.php?action=reject+24171

« previous php.notes (#34529) next »