Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
PHP and date > 2038?
I have a newbie question about PHP (I’m using 5.1) …
I’m trying to generate a very simple calendar, at any years (between 2000 and 2100). And date() is limited before 2038.
Does anyone know a simple replacement for it?
Offline
#2 2006-11-03 23:52:52
- NyteOwl
- Member
- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Re: PHP and date > 2038?
Since PHP date functions use integer timestamps in calculations, year dates are restricted to 1901-2038 on POSIX type systems (Unix, Linux, BSD, etc) and 1970-2038 on Windows because of integer overflow for dates beyond those years.
You might try using a third party library like ADOdb or manually doing your calculations using unsigned integers or floating point rather than signed integer math.
Last edited by NyteOwl (2006-11-03 23:54:21)
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
Offline
#4 2006-11-04 15:57:22
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: PHP and date > 2038?
By then the problem should be non-existent – we’ll all likely be using 64 bit machines.
PHP itself can’t handle unsigned integers. Here’s the ADOdb library (it uses floating points).
Offline
#5 2006-11-04 21:57:03
- NyteOwl
- Member
- From: Nova Scotia, Canada
- Registered: 2005-09-24
- Posts: 539
Re: PHP and date > 2038?
PHP itself can’t handle unsigned integers.
I suspected as much but wasn’t certain as I’m still learning ins and outs of PHP. :)
Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;
Offline
Re: PHP and date > 2038?
Thanks Mary, seems much more simple and effective than pear. I’ll try it.
Offline
Pages: 1