Bug #71945 [Opn->Nab]: Wrong timecalc prior 1956 -> summertime?

From: Date: Fri, 01 Apr 2016 16:01:41 +0000
Subject: Bug #71945 [Opn->Nab]: Wrong timecalc prior 1956 -> summertime?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200295@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71945&edit=1 ID: 71945 Updated by: derick@php.net Reported by: snoopyf at gmx dot net Summary: Wrong timecalc prior 1956 -> summertime? -Status: Open +Status: Not a bug Type: Bug Package: Date/time related Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: The correct result is "1956-04-11 23:00:00". Germany did not use summer time until 1980: Europe/Berlin Sun Apr 10 00:59:59 1949 UT = Sun Apr 10 01:59:59 1949 CET isdst=0 gmtoff=3600 Europe/Berlin Sun Apr 10 01:00:00 1949 UT = Sun Apr 10 03:00:00 1949 CEST isdst=1 gmtoff=7200 Europe/Berlin Sun Oct 2 00:59:59 1949 UT = Sun Oct 2 02:59:59 1949 CEST isdst=1 gmtoff=7200 Europe/Berlin Sun Oct 2 01:00:00 1949 UT = Sun Oct 2 02:00:00 1949 CET isdst=0 gmtoff=3600 Europe/Berlin Sun Apr 6 00:59:59 1980 UT = Sun Apr 6 01:59:59 1980 CET isdst=0 gmtoff=3600 Europe/Berlin Sun Apr 6 01:00:00 1980 UT = Sun Apr 6 03:00:00 1980 CEST isdst=1 gmtoff=7200 Europe/Berlin Sun Sep 28 00:59:59 1980 UT = Sun Sep 28 02:59:59 1980 CEST isdst=1 gmtoff=7200 Europe/Berlin Sun Sep 28 01:00:00 1980 UT = Sun Sep 28 02:00:00 1980 CET isdst=0 gmtoff=3600 Europe/Berlin Sun Mar 29 00:59:59 1981 UT = Sun Mar 29 01:59:59 1981 CET isdst=0 gmtoff=3600 Europe/Berlin Sun Mar 29 01:00:00 1981 UT = Sun Mar 29 03:00:00 1981 CEST isdst=1 gmtoff=7200 Europe/Berlin Sun Sep 27 00:59:59 1981 UT = Sun Sep 27 02:59:59 1981 CEST isdst=1 gmtoff=7200 Europe/Berlin Sun Sep 27 01:00:00 1981 UT = Sun Sep 27 02:00:00 1981 CET isdst=0 gmtoff=3600 It outputs the same on the shell as in PHP too: derick@whisky:~ $ TZ=Europe/Berlin date --date "@-433044000" Wed 11 Apr 23:00:00 CET 1956 The output in javascript also makes no sense, as "Thu Apr 12 1956 00:00:00 GMT+0200 (CET)" uses "+0200" for CET, but that's really supposed to be CEST. Previous Comments: ------------------------------------------------------------------------ [2016-04-01 15:49:16] snoopyf at gmx dot net Description: ------------ Having this Unix Timestamp: -433044000 and date.timezone in php.ini is set to "Europe/Berlin" this function: date("Y-m-d H:i:s"); returns: 1956-04-11 23:00:00 Test script: --------------- <?php echo(date_default_timezone_get()); echo(date("Y-m-d H:i:s",-433044000)); ?> Expected result: ---------------- The result should be: 1956-04-12 00:00:00 For me this seems to be summertime - related as 1956 was the current beginnig of summertime changes... Checking with JavaScript on the same machine gives the correct result: <script language="JavaScript"> var d=new Date(-433044000*1000); // *1000 as JavaScripts Date works with milliseconds since epoch, not seconds document.write(d); </script> This Snippet returns: Thu Apr 12 1956 00:00:00 GMT+0200 (CET) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71945&edit=1

« previous php.bugs (#200295) next »