php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62785 mktime() and strtotime() does not return anything for date '2050-12-31''
Submitted: 2012-08-09 10:00 UTC Modified: 2012-09-17 06:53 UTC
From: d dot sandip59 at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.4.5 OS: Windows XP
Private report: No CVE-ID: None
 [2012-08-09 10:00 UTC] d dot sandip59 at gmail dot com
Description:
------------
I have use this date:-
 $exp_date = "2050-12-31 00:00:00";
$timestamp = strtotime($exp_date);

echo $timestamp;

But i got no timestamp value for it.

Also, I am using this following code:-
list($year, $month, $date) = explode('-', $exp_date);
$timestamp = mktime(0,0,0, $month,$date,$year);
echo $timestamp;

But i also got no timestamp value for it.

Test script:
---------------
I have use this date:-
 $exp_date = "2050-12-31 00:00:00";
$timestamp = strtotime($exp_date);

echo $timestamp;


list($year, $month, $date) = explode('-', $exp_date);
$timestamp = mktime(0,0,0, $month,$date,$year);
echo $timestamp;



Expected result:
----------------
It show return a timestamp value even after the year 2037. Till the year 2037 it is returning valid timestamp value, but after that it does not return any timestamp value.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-09 12:13 UTC] anon at anon dot anon
https://en.wikipedia.org/wiki/Year_2038_problem
 [2012-08-09 12:16 UTC] pajoye@php.net
fix category
 [2012-08-09 12:16 UTC] pajoye@php.net
-Package: date_time +Package: Date/time related
 [2012-09-17 06:51 UTC] david at nnucomputerwhiz dot com
I can confirm that this bug does NOT exist in Debian Linux 64-bit but does exist 
in Windows XP 32-bit using the 5.4.7 binaries from php.net. Not sure if it's 
going to be possible to fix since it's probably OS dependent.
 [2012-09-17 06:53 UTC] aharvey@php.net
-Status: Open +Status: Not a bug
 [2012-09-17 06:53 UTC] aharvey@php.net
2050 is simply out of the range of valid timestamps on 32-bit systems.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 03:01:32 2025 UTC