php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74835 Timezone abbreviations missing for some timezones (e.g. ICT)
Submitted: 2017-06-30 12:55 UTC Modified: 2019-02-06 21:22 UTC
From: 6ec883313e at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 7.1.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: 6ec883313e at gmail dot com
New email:
PHP Version: OS:

 

 [2017-06-30 12:55 UTC] 6ec883313e at gmail dot com
Description:
------------
Timezone is shown as an offset instead of an abbreviation when formatting DateTime using T format character in some specific timezones such as Asia/Bangkok or Asia/Oral. It seems to be broken since PHP 7.0.9. It worked well before.
https://3v4l.org/SekI1

Test script:
---------------
$now = new DateTime('now', new DateTimeZone('Asia/Bangkok'));
echo $now->format('T');

Expected result:
----------------
ICT

Actual result:
--------------
+07

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-04 05:34 UTC] heiglandreas@php.net
-Status: Open +Status: Not a bug
 [2017-07-04 05:34 UTC] heiglandreas@php.net
This is not a bug but an intended behaviour from the underlying timezone-database. 6 months ago a lot of invented timezone-abbreviations where removed. "ICT" was one of them. As there is not an official abbreviation for the local timezone the abbreviation was removed and replaced with the offset. For details see https://github.com/eggert/tz/blame/master/asia#L3035

This shows: You should NEVER depend on timezone-abbreviations as they change!
 [2019-02-06 21:02 UTC] Sawickamonika at yahoo dot com
So how to display abbreviations for example for America/Sao_Paulo
or Asia/Dubai? There is no replacement timezone identifier which would have valid abbreviation for the same offset.
 [2019-02-06 21:22 UTC] requinix@php.net
@Sawickamonika: America/Sao_Paulo and Asia/Dubai do not have abbreviations anymore. At all. You can't display abbreviations because there aren't any for them.
As an alternative, consider using the UTC+HH offset.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 10:01:28 2024 UTC