note 89137 deleted from function.timezone-name-from-abbr by danbrown
| From: | danbrown@php.net | Date: | Mon, 23 Feb 2009 22:06:27 +0000 |
| Subject: | note 89137 deleted from function.timezone-name-from-abbr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151037@lists.php.net to get a copy of this message | ||
Note Submitter: Master Tablu
----
I think this function is superior to the other two below. It first asks timezone_name_from_abbr for
a name. If one is not found, we use the list to fill in the gap:
<?php
function getTZName($offset)
{
$isDst = date('I');
$offset *= 3600;
$zone = timezone_name_from_abbr('', $offset, $isDst);
if ($zone === false)
{
foreach (timezone_abbreviations_list() as $abbr)
{
foreach ($abbr as $city)
{
if ($city['timezone_id'] !== null && (bool)$city['dst']
== (bool)$isDst && $city['offset'] == $offset)
{
$zone = $city['timezone_id'];
}
}
}
}
return $zone;
}
?>