Is php date() and time() function works between the years 1901-2038. What function will I use for my long based projects. or I am wrong?
+5
A:
The timestamp only wraps around after January 19, 2038 on 32-bit systems. On 64-bit systems, this is not an issue, since most 64-bit operating systems use signed 64-bit integers for storing the timestamp. (With signed 64-bit integers, the timestamp wraps around on December 4, 292,277,026,596 AD.)
By 2038, I'd bet that most computer systems will be running on 64-bit architecture (at least), so it probably won't be a problem in the long run. Besides, there's nothing you yourself can do about it—it's an issue with the underlying operating system and processor architecture, not the code you write.
htw
2009-11-19 11:33:09
I've noted that in my diary.
pavium
2009-11-19 11:35:29
Thank you, I was little bit confused. Now I am cleared
RSK
2009-11-19 11:39:28
Then accept the anwser so he can get rep.
e-satis
2009-11-19 11:51:08
A:
You can always use the PEAR::Date class, it can be used for dates before 1970 and after 2038.
Example:
require_once 'Date.php';
$longAgo = new Date('1813-02-23T05:34:23');
echo $longAgo->getTime();
echo $longAgo->getDate();
Maybe also the The DateTime class can do it!?
powtac
2009-11-19 11:37:31