note 107630 deleted from datetime.modify by tularis
| From: | tularis@php.net | Date: | Wed, 22 Feb 2012 21:07:50 +0000 |
| Subject: | note 107630 deleted from datetime.modify by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-186302@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Adding months works when you apply the timezone again after the modify():
$tz = new DateTimeZone('Europe/Paris');
$date = new DateTime('2000-12-31', $tz);
$date->modify('+1 month');
$date->setTimeZone($tz);
echo $date->format('Y-m-d') . "\n";
will output: '2001-01-31'