#18802 [NEW]: mktime() not working with dates BEFORE dec 31,1969

From: Date: Thu, 08 Aug 2002 13:18:35 +0000
Subject: #18802 [NEW]: mktime() not working with dates BEFORE dec 31,1969
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16263@lists.php.net to get a copy of this message
From: judy@neurotrax.com Operating system: PHP version: 4.1.2 PHP Bug Type: Date/time related Bug description: mktime() not working with dates BEFORE dec 31,1969 I have the following code snippets in a php4 file: <? 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='2002-06-03'; 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='1963-05-14'; 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>"; ?> which produce the following output: this seems to work: date 2002-01-22 [01/22/2002] => Jan 22, 2002 so does this: date 2002-06-03 [06/03/2002] => Jun 3, 2002 so why not this? date 1928-07-10 [07/10/1928] =>Dec 31, 1969 or this? date 1963-05-14 [05/14/1963] =>Dec 31, 1969 ================= upon further testing, the mktime function cannot handle any date BEFORE Dec 31, 1969... as in the following program output: --------------------------- or this? date 1970-01-01 [01/01/1970] => Jan 1, 1970 or this? date 1960-01-01 [01/01/1960] => Dec 31, 196 I searched your bug report area with the keyword mktime() and did not find anything about this. Is this a known bug? -- Edit bug report at http://bugs.php.net/?id=18802&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=18802&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=18802&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=18802&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=18802&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=18802&r=support Expected behavior: http://bugs.php.net/fix.php?id=18802&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=18802&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=18802&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=18802&r=globals

« previous php.bugs (#16263) next »