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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: d dot sandip59 at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 02 07:01:30 2024 UTC