Bug #71945 [Nab]: Wrong timecalc prior 1956 -> summertime?
| From: | snoopyf at gmx dot net | Date: | Fri, 01 Apr 2016 18:24:13 +0000 |
| Subject: | Bug #71945 [Nab]: Wrong timecalc prior 1956 -> summertime? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200298@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
User updated by: snoopyf at gmx dot net
Reported by: snoopyf at gmx dot net
Summary: Wrong timecalc prior 1956 -> summertime?
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:
Yeah, u r right, for Germany summertime is since 1980, getted that wrong.
Then it's JavaScript which makes the mistake in your opinion? Till now I tested the JavaScript
Snippet on the current Versions of Firefox and Chrome under Linux and IE11 under Windows...
Each and every Browser/JavaScript says, that -433044000 is 2016-04-12 00:00:00
So who sais the truth now?
Previous Comments:
------------------------------------------------------------------------
[2016-04-01 16:01:15] derick@php.net
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.
------------------------------------------------------------------------
[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