Bug #77741 [Asn->Nab]: DateTimeZone/setTimezone returns wrong values
| From: | cmb@php.net | Date: | Mon, 02 Aug 2021 13:31:52 +0000 |
| Subject: | Bug #77741 [Asn->Nab]: DateTimeZone/setTimezone returns wrong values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235527@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77741&edit=1
ID: 77741
Updated by: cmb@php.net
Reported by: info at akebono dot nl
Summary: DateTimeZone/setTimezone returns wrong values
-Status: Assigned
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Windows 10
PHP Version: 7.2.16
-Assigned To: derick
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
PST is UTC-8, and Europe/Amsterdam on 2019-3-20T23:59:00 is UTC+1,
so nine hours difference are to be expected. PDT is also UTC-8
for the date extension, so the actual result is to be expected.
Note also that[1]:
| Please do not use any of the timezones listed here (besides
| UTC), they only exist for backward compatible reasons, and may
| expose erroneous behavior.
[1] <https://www.php.net/manual/en/timezones.others.php>
Previous Comments:
------------------------------------------------------------------------
[2019-03-16 15:31:08] girgias@php.net
Seems like PHP assumes the transition from Standard time to Summertime occurs at the same time which
is not the case with EU/USA.
Can you confirm this @derick?
------------------------------------------------------------------------
[2019-03-14 12:32:09] info at akebono dot nl
Description:
------------
Wrong value output. It does not matter whether TimeZoneNameFrom is set to PST or PDT.
Test script:
---------------
TimeZoneNameFrom = 'PST';
TimeZoneNameTo = 'Europe/Amsterdam';
TimeStr = '2019-3-20 23:59:00';
$convertedTime = date_create($TimeStr, new DateTimeZone($TimeZoneNameFrom))->setTimezone(new
DateTimeZone($TimeZoneNameTo))->format("j F H.i");
Expected result:
----------------
21 March 07.59 CET
Actual result:
--------------
21 March 08.59 CET
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77741&edit=1