php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54210 provide a function to canonicalize timezone strings
Submitted: 2011-03-09 23:28 UTC Modified: 2011-03-10 14:54 UTC
From: giorgio dot liscio at email dot it Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3.5 OS: all
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: giorgio dot liscio at email dot it
New email:
PHP Version: OS:

 

 [2011-03-09 23:28 UTC] giorgio dot liscio at email dot it
Description:
------------
hi, it is needed a function that converts "europe/rome" in "Europe/Rome"

for example the intl module (ICU) of php 5.3 does not accept "europe/rome" as timezone, but only "Europe/Rome", with uppercase first letters

thank you


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-10 07:16 UTC] scottmac@php.net
-Status: Open +Status: Bogus
 [2011-03-10 07:16 UTC] scottmac@php.net
$tz = implode('/', array_map('ucfirst', explode('/', $tz)));

No need to add a new function for this, and if the timezone is set by your app 
then you should probably store it in the correct format.
 [2011-03-10 07:16 UTC] scottmac@php.net
$tz = implode('/', array_map('ucfirst', explode('/', $tz)));

No need to add a new function for this, and if the timezone is set by your app 
then you should probably store it in the correct format.
 [2011-03-10 14:54 UTC] dtajchreber@php.net
Not that it's hard to implement in userland code but it'd be nice if the 
DateTimezone class gave the timezone name in canonical form... I don't see why 
it shouldn't either?

$dt = new DateTimezone('america/chicago');
var_dump($dt->getName()); /* string(15) "america/chicago" */

vs. 

$dt = new DateTime();
var_dump($dt->getTimezone()->getName()); /* string(16) "Australia/Sydney" */
 [2011-03-11 15:53 UTC] giorgio dot liscio at email dot it
exact, it is not a problem implement this in the user space

but it is nonsense since some php functions requires a canonical tz string
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 13:01:32 2024 UTC