|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77741 DateTimeZone/setTimezone returns wrong values
Submitted: 2019-03-14 12:32 UTC Modified: 2021-08-02 13:31 UTC
From: info at akebono dot nl Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: 7.2.16 OS: Windows 10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: info at akebono dot nl
New email:
PHP Version: OS:


 [2019-03-14 12:32 UTC] info at akebono dot nl
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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-16 15:31 UTC]
-Assigned To: +Assigned To: derick
 [2019-03-16 15:31 UTC]
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?
 [2021-08-02 13:31 UTC]
-Status: Assigned +Status: Not a bug -Assigned To: derick +Assigned To: cmb
 [2021-08-02 13:31 UTC]
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] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 20:01:31 2024 UTC