|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23475 mktime() of dates before 1 jan 1970 gives a timestamp of "-3662"
Submitted: 2003-05-04 05:32 UTC Modified: 2003-05-04 12:23 UTC
From: guy dot mersch at pandora dot be Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.1 OS: Linux
Private report: No CVE-ID: None
 [2003-05-04 05:32 UTC] guy dot mersch at pandora dot be
mktime(0,0,0,10,4,1980) returns 339462000 
mktime(0,0,0,10,4,1970) returns 23842800 
mktime(0,0,0,10,4,1960) returns -3662 
mktime(0,0,0,10,4,1950) returns -3662 

mktime(0,0,0,1,1,1980) returns 315532800 
mktime(0,0,0,1,1,1970) returns -3600 
mktime(0,0,0,1,1,1960) returns -3662 
mktime(0,0,0,1,1,1950) returns -3662 

mktime(0,0,0,12,31,1989) returns 631065600 
mktime(0,0,0,12,31,1979) returns 315446400 
mktime(0,0,0,12,31,1969) returns -3662 
mktime(0,0,0,12,31,1959) returns -3662 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-04 05:42 UTC]
What is the problem here?
 [2003-05-04 05:55 UTC] guy dot mersch at pandora dot be
Problem is that once you want to create a Timestamp for 
dates earlier than 1 Jan 1970 you always get "-3662" no 
matter what date you filled in.
 [2003-05-04 05:58 UTC]
But that's not a bug in PHP, but more in your glibc :) Which version of glibc do you use? AFAIK the 2.3.x series return an undefined value for dates smaller than 1 - 1 - 1970, much like Windows does.
 [2003-05-04 10:35 UTC] guy dot mersch at pandora dot be
the linux server uses glibc 2.2.5 stable
 [2003-05-04 11:44 UTC] guy dot mersch at pandora dot be
There seems to be indeed a problem with glibc 2.2.5 and 
the mktime function for dates earlier than 01/01/1970

This could be a solution:
adodb_time library uses PHP code to calculate negative 
 [2003-05-04 12:23 UTC]
Right, it's not a bug in PHP then -> bogus (There is somebody working on an extension for PHP 5 to address this AFAIK).
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 15:01:34 2024 UTC