Re: RFC for Adding __toString to DateTime
| From: | Will Fitch | Date: | Sun, 02 Sep 2012 20:48:08 +0000 |
| Subject: | Re: RFC for Adding __toString to DateTime | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62686@lists.php.net to get a copy of this message | ||
On Sep 2, 2012 4:39 PM, "Andrew Faulds" <ajf@ajf.me> wrote:
>
> On 02/09/12 18:20, Derick Rethans wrote:
>>
>>
>> No it's not unambigious:
>>
>> $ php -r 'date_default_timezone_set("Europe/London"); echo
date_create()->format(DateTime::ISO8601), "\n";'
>> 2012-09-02T18:17:36+0100
>>
>> $ php -r 'date_default_timezone_set("Africa/Niamey"); echo
date_create()->format(DateTime::ISO8601), "\n";'
>> 2012-09-02T18:19:05+0100
>>
>> vs:
>>
>> $ php -r 'date_default_timezone_set("Africa/Niamey"); echo
date_create("2012-12-31")->format(DateTime::ISO8601), "\n";'
>> 2012-12-31T00:00:00+0100
>> ^^^^^
>>
>> $ php -r 'date_default_timezone_set("Europe/London"); echo
date_create("2012-12-31")->format(DateTime::ISO8601), "\n";'
>> 2012-12-31T00:00:00+0000
>> ^^^^^
>
> I'm a little confused as to what is going on here, but ISO8601 has a UTC
format, YYYY-MM-DDTHH:MM:SSZ.
I think the issue on most minds is the TZ aspect. I agree with the others
on using UTC. I also think ill suggest a different approach to this.
>>
>> cheers,
>> Derick
>
>
>
> --
> Andrew Faulds
> http://ajf.me/
>