Hi Ivan,

$d = new \DateTime('+1 hour', new \DateTimeZone('Europe/Amsterdam'));

Is exactly the same as:

// Current timestamp with timezone

$d = new \DateTime(null, new \DateTimeZone('Europe/Amsterdam'));
// Add 1 hour to the timestamp with timezone
$d->modify('+1 hour');


This is what you would like to do right? As modifying the timestamp with
another timestamp would make no sense to me.

Kind regards,

Chris van Dam

Op 26-11-12 12:06 schreef 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) 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/
>
>
>
>--
>PHP Internals - PHP Runtime Development Mailing List
>To unsubscribe, visit: http://www.php.net/unsub.php
>


E-mail disclaimer Nederlands
De informatie verzonden met dit e-mailbericht is vertrouwelijk en kan wettelijk 
voorbehouden zijn. Het is uitsluitend bestemd voor de geadresseerde. Gebruik 
van deze informatie door anderen dan de geadresseerde en zij die gerechtigd 
zijn daarvan kennis te nemen is verboden. Trace staat niet in voor de juiste en 
volledige overbrenging van de inhoud van een verzonden e-mail, noch voor 
tijdige ontvangst daarvan.
E-mail disclaimer English
The information contained in this communication is confidential and may be 
legally privileged. It is intended solely for the use of the individual or 
entity to whom it is addressed and others authorized to receive it. The use of 
it by others is prohibited. Trace is neither liable for the proper and complete 
transmission of the information contained in this communication nor for any 
delay in its receipt.


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to