2010/1/19 Ashley Sheridan <a...@ashleysheridan.co.uk>:
> On Mon, 2010-01-18 at 22:46 -0800, Michael A. Peters wrote:
>
>> php 5.2.12 running in CentOS 5.x
>>
>> Unfortunately, both my server (xen linode) and my test server (crappy
>> old dell I found in a field) are 32-bit. I need to work with some dates
>> earlier than 1901 and I would really prefer to store them in *nix time
>> in the database and use the date() function to format them for display
>> when I need to.
>>
>> My understanding is that 32 bit php has a lower limit in 1901 and upper
>> limit in 2038 for the date function.
>>
>> Is there a pcre / pecl / other wrapper that behaves identical to the
>> date function but uses a 64 bit float in 32 bit php?
>>
>> Yes, the right thing to do is probably to use 64 bit, and if I could I
>> would. A wrapper that just passes it off to date on 64 bit systems and
>> to date on 32 bit systems within what data can handle and only does its
>> magic on 32 bit systems with values beyond 32-bit date capabilities
>> would be sweet.
>>
>
>
> I've not used it, but the Pear Date class looks like it should do what
> you need. I've used other Pear classes before, and they are pretty easy
> to get to grips with, so I assume it should be the same for this one
> too.
>
> http://pear.php.net/package/Date
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

php -r "$o = new DateTime('1066-10-14T14:30:00+0000'); echo $o->format('r');"

Battle of Hastings. Just after 2:30 on the 14th of October 1066.

As I understand things, the DateTime class avoids the 32bit issue entirely.

Take a listen to the excellent PHP|Architect Summer Web cast from last
year by Derick Rethans [1] & [2].

Regards,

Richard.

[1] http://phparch.com/webcasts
[2] http://mtadata.s3.amazonaws.com/webcasts/20090828-date-time.wmv
-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to