Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89264 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87921 invoked from network); 17 Nov 2015 11:23:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2015 11:23:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:40972] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6B/04-57591-E1E0B465 for ; Tue, 17 Nov 2015 06:23:10 -0500 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id F27C2E20D6; Tue, 17 Nov 2015 11:23:06 +0000 (GMT) Date: Tue, 17 Nov 2015 11:23:06 +0000 (GMT) X-X-Sender: derick@whisky.home.derickrethans.nl To: Martin Keckeis cc: PHP internals In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Re: [PHP-DEV] DateTime / Timezone funny behaviour, between different version From: derick@php.net (Derick Rethans) 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