|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 02:00:01 2025 UTC |
$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.$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.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" */