note 117963 rejected from datetime.add by cmb

From: Date: Wed, 09 Sep 2015 13:54:25 +0000
Subject: note 117963 rejected from datetime.add by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203754@lists.php.net to get a copy of this message
Note Submitter: pedrosalpr at gmail dot com ---- When a datetime object has date '2012-01-30', we have the following object: object(DateTime)#1233 (3) { ["date"]=> string(19) "2012-01-30 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(9) "ETC/GMT+3" } But, when a month is added: $date->add(new DateInterval('P1M')); It will result the following object: object(DateTime)#1233 (3) { ["date"]=> string(19) "2012-03-01 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(9) "ETC/GMT+3" } It should add a month, so the date to be displayed should be '2012-02-28', therefore february of 2012, instead of march of 2012.

« previous php.notes (#203754) next »