|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76576 DateTime formats different Timezones with 'e' and 'T' format codes
Submitted: 2018-07-04 08:13 UTC Modified: 2018-07-04 09:09 UTC
From: nospam at tils dot org Assigned:
Status: Open Package: Date/time related
PHP Version: 7.2.7 OS: Ubuntu
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-07-04 08:13 UTC] nospam at tils dot org
If you set a timezone on a DateTime object and you output "e" and "T" values, different Timezones will be returned. I have a german system here and PHP 7.2 seems to always output the system timezone in "T", but output the manually assigned timezone in "e".

In PHP 5.6 the output of the test script is: "12:15:03 UTC UTC"
In PHP 7.2.7 the output is: "12:15:03 UTC CEST"

Test script:

$date = new Datetime('2018-05-01 12:15:03');
$date->setTimeZone(new DateTimeZone('UTC'));

echo $date->format('H:i:s e T');


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-07-04 08:51 UTC]
-Status: Open +Status: Feedback
 [2018-07-04 08:51 UTC]
I can't figure out how to reproduce this. Are you running that exact script? Unchanged? Are you doing anything else with timezones? Do you have the date.timezone setting something other than UTC?
 [2018-07-04 08:59 UTC] nospam at tils dot org
I have one machine: OpenSuSE Tumbleweed with 20180626 php 5.6.31 
The other machine is a docker container with Ubuntu 16.04.4 LTS and php 7.2.7

The output of ini_get('date.timezone') on the (working) 5.6 installation is "UTC", on the (broken) 7.2 installation is "".

If I add an ini_set('date.timezone', 'UTC') the 7.2 also shows the same problem.

I start the very same script inside the docker container by php-cli and outside in the host system. So yes, they are the same.
 [2018-07-04 09:09 UTC]
-Status: Feedback +Status: Open
 [2018-07-04 09:09 UTC]
Well, all I can think of is that your timezone database is messed up and somehow has a "UTC" timezone mapped to CEST.
 [2018-07-04 09:59 UTC] nospam at tils dot org
Regarding your assumption I added the output of DateTime::listAbbrevations().

I didnt find a method to add a file here, so here you can find it:
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Dec 04 02:01:23 2020 UTC