note 91977 deleted from datetime.modify by danielc

From: Date: Wed, 05 May 2010 03:25:53 +0000
Subject: note 91977 deleted from datetime.modify by danielc
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-168943@lists.php.net to get a copy of this message
Note Submitter: tacker at php dot net ---- Do not use '[+/-]{n} month' to get the last day of the month. If you use '+1 month' on the first of the month, it sets the date to the next first of the month. This behaviour gives the impression, that php considers the length of a month, which is not true. Basically if you use '+1 month' it takes the month number, adds 1 and parses result as a new date. But if you use '+1 month' on the last day of a month, the result is unexpected as 2009-05-31 becomes 2009-06-31 which is an invalid date and then interpreted as 2009-07-01.

« previous php.notes (#168943) next »