note 89136 added to function.timezone-name-from-abbr
| From: | MasterTablu at osu1 dot php dot net | Date: | Mon, 23 Feb 2009 21:44:40 +0000 |
| Subject: | note 89136 added to function.timezone-name-from-abbr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-151034@lists.php.net to get a copy of this message | ||
It is probably best to include a check for daylight savings time in the proposed function:
<?php
/* Takes a GMT offset (in hours) and returns a timezone name */
function tz_offset_to_name($offset)
{
$isDst = (bool)date('I');
$offset *= 3600; // convert hour offset to seconds
$abbrarray = timezone_abbreviations_list();
foreach ($abbrarray as $abbr)
{
foreach ($abbr as $city)
{
if ((bool)$city['dst'] == $isDst && $city['offset'] ==
$offset)
{
return $city['timezone_id'];
}
}
}
return FALSE;
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 66.138.198.129
----
Manual Page -- http://www.php.net/manual/en/function.timezone-name-from-abbr.php
Edit -- https://master.php.net/note/edit/89136
Del: integrated -- https://master.php.net/note/delete/89136/integrated
Del: useless -- https://master.php.net/note/delete/89136/useless
Del: bad code -- https://master.php.net/note/delete/89136/bad+code
Del: spam -- https://master.php.net/note/delete/89136/spam
Del: non-english -- https://master.php.net/note/delete/89136/non-english
Del: in docs -- https://master.php.net/note/delete/89136/in+docs
Del: other reasons-- https://master.php.net/note/delete/89136
Reject -- https://master.php.net/note/reject/89136
Search -- https://master.php.net/manage/user-notes.php