|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-01-23 10:41 UTC] derick@php.net
[2013-01-23 10:41 UTC] derick@php.net
-Status: Open
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 15 23:00:01 2025 UTC |
Description: ------------ Using the current datetime, adding and subtracting one month does not result in an actual one month addition and subtraction Test script: --------------- <td valign="top"> <?php $previousMonth = new DateTime ('2013-03-31'); $previousMonth->sub (new DateInterval ('P1M')); echo $previousMonth->format ('Y-m-d'); ?> </td> <td valign="top"> <?php $nextMonth = new DateTime ('2013-03-31'); $nextMonth->add (new DateInterval ('P1M')); echo $nextMonth->format ('Y-m-d'); ?> </td> Expected result: ---------------- previous month to show 2013-02-*, next month to show 2013-04-* Actual result: -------------- <td>2013-03-03</td><td>2013-05-01</td>