Edit report at https://bugs.php.net/bug.php?id=64052&edit=1

 ID:                 64052
 Updated by:         der...@php.net
 Reported by:        moses dot liao at techlinkz dot net
 Summary:            PHP DateTime Add and sub
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Date/time related
 Operating System:   Linux
 PHP Version:        5.3.21
 Block user comment: N
 Private report:     N

 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

This has been filed so many times, and it's still not a bug. For a full 
explanation, see: http://derickrethans.nl/obtaining-the-next-month-in-php.html


Previous Comments:
------------------------------------------------------------------------
[2013-01-23 03:07:22] moses dot liao at techlinkz dot net

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>


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=64052&edit=1

Reply via email to