note 80253 deleted from ref.datetime by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 02:19:41 +0000 |
| Subject: | note 80253 deleted from ref.datetime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141950@lists.php.net to get a copy of this message | ||
Note Submitter: Dave Laurier
----
I really like the date_diff function from stoicnluv because of its capabilities to handle leap years
and daylight saving time but I found out is is not working correctly when there is more than 1 year
and 2 months between the two dates. For example:
d1 = 2006-10-28
d2 = 2007-11-30
The result for months and days is correct (one year, one month and two days):
Array
(
[years] => 1
[months] => 1
[days] => 2
[hours] => 1
[minutes] => 0
[seconds] => 0
[months_total] => 12
[days_total] => 398
[hours_total] => 9553
[minutes_total] => 573180
[seconds_total] => 34390800
)
However when using a date which is +1 year +2 months:
d1 = 2006-10-28
d2 = 2007-12-01
The result is incorrect (expected: one year, two months and 1 day, returns one year, one month and 3
days):
Array
(
[years] => 1
[months] => 1
[days] => 3
[hours] => 1
[minutes] => 0
[seconds] => 0
[months_total] => 12
[days_total] => 399
[hours_total] => 9577
[minutes_total] => 574620
[seconds_total] => 34477200
)