2012/11/26 Ivan Enderlin @ Hoa <ivan.ender...@hoa-project.net>

> 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 <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”.
>

It's not like "modify to something", but "modify _with_ something". With
your point of view "modifiy('+7 days')" will _always_ point to next week,
but it should (and it's intuitive right), that it will point to 7 days
after the previous date. So what should "modify with now" mean?

Other way round: You are looking for the "set*()"-methods :) Because you
want to _set_ a date, not modify one.

Regards,
Sebastian


> 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/
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
github.com/KingCrunch

Reply via email to