Re: DateTime / Timezone funny behaviour, between different version
| From: | Derick Rethans | Date: | Tue, 17 Nov 2015 11:23:06 +0000 |
| Subject: | Re: DateTime / Timezone funny behaviour, between different version | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89264@lists.php.net to get a copy of this message | ||
On Tue, 17 Nov 2015, Martin Keckeis wrote:
> Hello together,
>
> i just noticed that the date + timezone switching changed a lot last time?
>
> tl;dr https://3v4l.org/pSplY
>
> When taking a old datetime:
> $date = \DateTime::createFromFormat('d.m.Y H:i:s', '01.01.1900 00:00:00',
> new \DateTimeZone('Europe/Berlin'));
>
> and switching between the given timezone and UTC, the date is sometimes
> corrected with some minutes+seconds and sometimes not.
Berlin had some interesting timezone rules:
Europe/Berlin Fri Mar 31 23:06:31 1893 UT = Fri Mar 31 23:59:59 1893 LMT isdst=0 gmtoff=3208
Europe/Berlin Fri Mar 31 23:06:32 1893 UT = Sat Apr 1 00:06:32 1893 CET isdst=0 gmtoff=3600
Europe/Berlin Sun Apr 30 21:59:59 1916 UT = Sun Apr 30 22:59:59 1916 CET isdst=0 gmtoff=3600
Europe/Berlin Sun Apr 30 22:00:00 1916 UT = Mon May 1 00:00:00 1916 CEST isdst=1 gmtoff=7200
But there was a bug in PHP where we'd ignore the first block, and hence
picked a UTC offset of gmtoff=3208 for 1900-01-01, which was wrong.
That's now fixed again.
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