ID:               47846
 Updated by:       ras...@php.net
 Reported By:      brooksie155 at yahoo dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: CentOS
 PHP Version:      5.2CVS-2009-03-31 (snap)
 New Comment:

Not a bug.  As documented, this defaults to now and you can override
individual components in the constructor.  In your case you have chosen
Feb. 2009, but didn't specify a day of the month.  PHP picks todays day,
which is the 31st day of the month.  The 31st day of Feb will fall in
March since Feb doesn't have 31 days.


Previous Comments:
------------------------------------------------------------------------

[2009-03-31 08:44:45] brooksie155 at yahoo dot com

Description:
------------
There is a bug in the constructor of this object if you are only
specifying the month and the year when dealing with the month of
February.





Reproduce code:
---------------
$date = new DateTime('2009-02');
echo $date->format('Y-m');

Expected result:
----------------
2009-02

Actual result:
--------------
2009-03


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


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

Reply via email to