php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18802 mktime() not working with dates BEFORE dec 31,1969
Submitted: 2002-08-08 09:18 UTC Modified: 2002-08-08 09:23 UTC
From: judy at neurotrax dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.1.2 OS:
Private report: No CVE-ID: None
 [2002-08-08 09:18 UTC] judy at neurotrax dot 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?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-08 09:20 UTC] judy at neurotrax dot com
that last line should read Dec 31, 1969 [the 9 got chopped when I did the copy] - sorry
 [2002-08-08 09:23 UTC] sander@php.net
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


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 04:01:38 2024 UTC