note 111228 added to datetime.add
| From: | James | Date: | Tue, 29 Jan 2013 05:34:48 +0000 |
| Subject: | note 111228 added to datetime.add | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193419@lists.php.net to get a copy of this message | ||
I've just noticed that if you add a month to a DateTime object representing the 29th January,
you'll end up in March:
<?php
$datetime = new DateTime('29-01-2013');
echo $datetime->format('r'); // Tue, 29 Jan 2013 00:00:00 +0100
$datetime->add(new DateInterval('P1M'));
echo $datetime->format('r'); // Fri, 01 Mar 2013 00:00:00 +0100
----
Server IP: 69.147.83.199
Probable Submitter: 82.161.119.32
----
Manual Page -- http://php.net/manual/en/datetime.add.php
Edit -- https://master.php.net/note/edit/111228
Del: integrated -- https://master.php.net/note/delete/111228/integrated
Del: useless -- https://master.php.net/note/delete/111228/useless
Del: bad code -- https://master.php.net/note/delete/111228/bad+code
Del: spam -- https://master.php.net/note/delete/111228/spam
Del: non-english -- https://master.php.net/note/delete/111228/non-english
Del: in docs -- https://master.php.net/note/delete/111228/in+docs
Del: other reasons-- https://master.php.net/note/delete/111228
Reject -- https://master.php.net/note/reject/111228
Search -- https://master.php.net/manage/user-notes.php