Re: Calculating dates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Mar 1, 2008 at 8:42 AM, Brice <brice.favre@xxxxxxxxx> wrote:

> I like this way too but it will not work with a date before the first
> January 1901.
>
> Do you have another method?


the DateTime class uses an unsigned 64 bit integer to represent the unix
timestamp internally.  as a result it can handle such dates w/o a problem.

php > $dt1 = date_create('1856-02-27');
php > $dt2 = date_create('1855-12-03');
php > echo ($dt1->format('U') - $dt2->format('U')) / 86400;
86

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux