DateTime::modify('now') is ignored, why?
| From: | Ivan Enderlin @ Hoa | Date: | Mon, 26 Nov 2012 11:06:09 +0000 |
| Subject: | DateTime::modify('now') is ignored, why? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-64043@lists.php.net to get a copy of this message | ||
Hi internals,
I would to modify a \DateTime object to the current time, thus I wrote this:
$d = new \DateTime('+1 hour');
$d->modify('now');
It did not work. Why? Because the documentation (http://php.net/datetime.formats.relative) says: “Now - this is simply ignored”. Really? But the behavior is pretty straightforward isn't? “modify to now” means “set to the current date and time and let the timezone unchanged”.
Thoughts?
Best regards.
--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/
PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/
Member of HTML and WebApps Working Group of W3C
http://w3.org/