php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34805 strtotime ceases to work on future years
Submitted: 2005-10-10 12:11 UTC Modified: 2005-10-10 12:41 UTC
From: alex at magickal dot co dot uk Assigned: derick (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5CVS-2005-10-10 (cvs) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alex at magickal dot co dot uk
New email:
PHP Version: OS:

 

 [2005-10-10 12:11 UTC] alex at magickal dot co dot uk
Description:
------------
strtotime converts dates into nice handlable integers. This should work on ALL dates. I can see no reason whatsoever why it should cease half way through a century! Its a bit too much like the millenium bug!

And as such IS a bug.

Alex


Reproduce code:
---------------
$defaultdate = strtotime("01 January 2050");
echo $defaultdate;



Expected result:
----------------
expected result would be an integer NOT -1.

Actual result:
--------------
-1

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-10 12:24 UTC] sniper@php.net
And within Linux it returns bool(false), Derick, anything you can do about this or do we just document it or reclassify this as feature request? :)
 [2005-10-10 12:41 UTC] derick@php.net
Can't do anything about this, as PHP's int is only 32bit signed. The unix timestamp runs out of positions in this field  somewhere in 2038. If you want to use dates like this, you have to wait until can enable the new date/time routines that allow you to deal with this properly (although you won't get a timestamp back). An example of how the new code looks like:

<?php
    $d = date_create("01 January 2050");

    echo date_format($d, DATE_RFC822), "\n"
?>

(But you'll have to wait until PHP 5.1.1)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 21:01:29 2024 UTC