Re: RFC for Adding __toString to DateTime
| From: | Derick Rethans | Date: | Mon, 03 Sep 2012 13:25:11 +0000 |
| Subject: | Re: RFC for Adding __toString to DateTime | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62740@lists.php.net to get a copy of this message | ||
On Mon, 3 Sep 2012, Will Fitch wrote:
> On Mon, Sep 3, 2012 at 8:09 AM, Lars Strojny <lars@strojny.net> wrote:
>
> > Additionally to what Ryan proposed, microseconds should be part of it
> > (which ISO allows). So, here we go:
> >
> > 2012-09-02T18:17:36.12345+0100 (Europe/London)
>
> Hi Lars - there wouldn't be a need for the offset if the string
> provides the timezone name.
And you are wrong again:
<?php
$d = date_create( "@1351385100" );
$d->setTimeZone( new DateTimeZone( 'Europe/London' ) );
echo $d->format( 'Y-m-d H:i:s (e)' ), "\n";
$d = date_create( "@1351388700" ); // one hour later
$d->setTimeZone( new DateTimeZone( 'Europe/London' ) );
echo $d->format( 'Y-m-d H:i:s (e)' ), "\n";
outputs:
2012-10-28 01:45:00 (Europe/London)
2012-10-28 01:45:00 (Europe/London)
And it's clearly not the same moment in time...
> Parsing this wouldn't be an issue,
It is an issue - there is even an RFC (that I still need to implement)
for it: https://wiki.php.net/rfc/datetime_and_daylight_saving_time
cheers,
Derick
--
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Posted with an email client that doesn't mangle email: alpine