On Sun, 2 Sep 2012, Andrew Faulds wrote:

> On 02/09/12 14:40, Benjamin Eberlei wrote:
> > I think allowing to change teh default format would be horrible. If
> > libraries (such as Doctrine would) use this internally, they are at the will
> > of users not to fiddle with this setting. Not to speak about libraries that
> > contradict each other.
> > 
> > If there was a format, it would have to be constant imho.
>
> Then ISO8601, please. It's a single, unambiguous Date and Time format.

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
                   ^^^^^

cheers,
Derick

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

Reply via email to