[PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Ivan Enderlin @ Hoa
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

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Chris van Dam
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

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Sebastian Krebs
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.*

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Ivan Enderlin @ Hoa
Hi Chris, You didn't understand. I have a \DateTime object, and I would like to change the date and time to the current date and time = now. Imagine you have a \DateTime object that was serialized and you would like to “refresh” it, you need to $d-modify('now'). This is strictly equivalent to

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Ivan Enderlin @ Hoa
Hi Sebastien, On 26/11/12 12:25, Sebastian Krebs wrote: 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

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Derick Rethans
On Mon, 26 Nov 2012, Ivan Enderlin @ Hoa wrote: On 26/11/12 12:25, Sebastian Krebs wrote: 2012/11/26 Ivan Enderlin @ Hoa ivan.ender...@hoa-project.net I would to modify a \DateTime object to the current time, thus I wrote this: $d = new \DateTime('+1 hour');

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Ivan Enderlin @ Hoa
On 26/11/12 13:02, Derick Rethans wrote: On Mon, 26 Nov 2012, Ivan Enderlin @ Hoa wrote: On 26/11/12 12:25, Sebastian Krebs wrote: 2012/11/26 Ivan Enderlin @ Hoa ivan.ender...@hoa-project.net I would to modify a \DateTime object to the current time, thus I wrote this: $d = new

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Nikita Nefedov
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

Re: [PHP-DEV] DateTime::modify('now') is ignored, why?

2012-11-26 Thread Derick Rethans
On Mon, 26 Nov 2012, Nikita Nefedov wrote: On Mon, 26 Nov 2012 15:06:09 +0400, Ivan Enderlin @ Hoa ivan.ender...@hoa-project.net wrote: 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