#18802 [Opn->Bgs]: mktime() not working with dates BEFORE dec 31,1969

From: Date: Thu, 08 Aug 2002 13:23:46 +0000
Subject: #18802 [Opn->Bgs]: mktime() not working with dates BEFORE dec 31,1969
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-16266@lists.php.net to get a copy of this message
ID: 18802 Updated by: sander@php.net Reported By: judy@neurotrax.com -Status: Open +Status: Bogus Bug Type: Date/time related PHP Version: 4.1.2 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Previous Comments: ------------------------------------------------------------------------ [2002-08-08 09:20:21] judy@neurotrax.com that last line should read Dec 31, 1969 [the 9 got chopped when I did the copy] - sorry ------------------------------------------------------------------------ [2002-08-08 09:18:34] judy@neurotrax.com 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 this bug report at http://bugs.php.net/?id=18802&edit=1

« previous php.bugs (#16266) next »