php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37317 mktime problem
Submitted: 2006-05-04 23:20 UTC Modified: 2006-05-04 23:48 UTC
From: ramsessivira at yahoo dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.3 OS: windows xp
Private report: No CVE-ID: None
 [2006-05-04 23:20 UTC] ramsessivira at yahoo dot com
Description:
------------
For years up to 2038 the mktime instruction does not give back any result

Reproduce code:
---------------
for($x=2037;$x<2041;$x++){
  echo mktime(0,0,0,1,1,$x)."   Date:  ".date( "M-d-Y",mktime(0,0,0,1,1,$x))."<br>";
}


Expected result:
----------------
2114395200 Date: Jan-01-2037
2145931200 Date: Jan-01-2038
some value Date: Jan-01-2039
some value Date: Jan-01-2040

Actual result:
--------------
2114395200 Date: Jan-01-2037
2145931200 Date: Jan-01-2038
Date: Dec-31-1969
Date: Dec-31-1969

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-04 23:22 UTC] tony2001@php.net
Yes, because in 2038 integer overflow is going to happen.
 [2006-05-04 23:48 UTC] ramsessivira at yahoo dot com
What can i do to fix the problem?
I am trying to calculate the age being started off of the birthday
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 13:01:33 2025 UTC