php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36338 Integer Timestamps are not enough!
Submitted: 2006-02-09 12:27 UTC Modified: 2006-02-10 13:12 UTC
From: carsten dot moldenhauer at mailbox dot tu-dresden dot d Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.2 OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: carsten dot moldenhauer at mailbox dot tu-dresden dot d
New email:
PHP Version: OS:

 

 [2006-02-09 12:27 UTC] carsten dot moldenhauer at mailbox dot tu-dresden dot d
Description:
------------
Hello PHP Team.

I recently discovered a problem with standard timestamps. They are stored as integers. Integers have a range up to 2147483647.

date( "Y-m-d H:i:s", 2147483647 ) results in:
2038-01-19 04:14:07

If you got a date after 2038 in text format and want to convert it to integer, you will get back 2147483647. So you are back in 2038 again.

I would dislike to see all the time related PHP applications break on the above date.

Is there any possibility to switch timestamps to long?
(btw, the same occurs with dates before 1901-12-13 21:45:52 which is date( "Y-m-d H:i:s, -2147483648 ))

I am looking forward to your answers.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-09 14:51 UTC] tony2001@php.net
This is OS limitation and PHP has nothing to do with it.
 [2006-02-10 13:12 UTC] derick@php.net
Also the new date/time functionality does support 64 bits... except that it's not enabled yet
 [2011-04-17 15:06 UTC] dosergio at ig dot com dot br
"This is OS limitation and PHP has nothing to do with it."
I disagree. The limitation occurs because the argument is an integer. If PHP used double for instance, the limitation would not exist. Inside the function they could apply round(double) that would return a LONG instead of using a OS limited integer. I Suggest the developers to think about using double argument and round it inside the function to obtain a LONG INTEGER.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 14:04:04 2025 UTC