|  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: 2019-03-16 15:31 UTC
From: info at akebono dot nl Assigned: derick (profile)
Status: Assigned Package: Date/time related
PHP Version: 7.2.16 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
7 - 7 = ?
Subscribe to this entry?

 [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?
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jun 22 23:01:24 2021 UTC