On Mon, 26 Nov 2012 15:06:09 +0400, Ivan Enderlin @ Hoa
<ivan.ender...@hoa-project.net> wrote:
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.
Shouldn't DateTime be immutable? What's the point of DateTime object being
mutable?
I would include my point about why DateTime should be immutable but I even
can't come with any points except OO-logic and all I can say is I just
feel like mutable DateTime is wrong. What you think about it?
PS I'm not Nikita Popov (aka nikic) :)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php