#48824 [Com]: dateTime->add() doesn't properly account for days past the end of months
| From: | sjoerd-php at linuxonly dot nl | Date: | Tue, 07 Jul 2009 09:50:49 +0000 |
| Subject: | #48824 [Com]: dateTime->add() doesn't properly account for days past the end of months | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139374@lists.php.net to get a copy of this message | ||
ID: 48824
Comment by: sjoerd-php at linuxonly dot nl
Reported By: brad at omnis dot com
Status: Open
Bug Type: Date/time related
Operating System: Linux (CentOS 5.3)
PHP Version: 5.3.0
New Comment:
Thank you for your report.
The issue you report is not a bug. See also bug #43999.
Previous Comments:
------------------------------------------------------------------------
[2009-07-06 22:24:39] brad at omnis dot com
Description:
------------
dateTime->add(dateInterval) isn't applying proper calendar math when
adding intervals.
Reproduce code:
---------------
$dateTest = new dateTime('2008-01-31',new dateTimeZone("GMT"));
print_r($dateTest);
$dateTest->add(new dateInterval('P1M'));
print_r($dateTest);
Expected result:
----------------
DateTime Object
(
[date] => 2008-01-31 00:00:00
[timezone_type] => 3
[timezone] => UTC
)
DateTime Object
(
[date] => 2008-02-28 00:00:00
[timezone_type] => 3
[timezone] => UTC
)
Actual result:
--------------
DateTime Object
(
[date] => 2008-01-31 00:00:00
[timezone_type] => 3
[timezone] => UTC
)
DateTime Object
(
[date] => 2008-03-02 00:00:00
[timezone_type] => 3
[timezone] => UTC
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48824&edit=1