Re: Calculating dates
| From: | Nathan Nobbe | Date: | Sat, 01 Mar 2008 14:39:44 +0000 |
| Subject: | Re: Calculating dates | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-270802@lists.php.net to get a copy of this message | ||
On Sat, Mar 1, 2008 at 8:42 AM, Brice <brice.favre@gmail.com> 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