note 86928 added to function.timezone-name-from-abbr

From: Date: Tue, 11 Nov 2008 01:25:29 +0000
Subject: note 86928 added to function.timezone-name-from-abbr
Groups: php.notes 
Request: Send a blank email to php-notes+get-146373@lists.php.net to get a copy of this message
timezone_name_from_abbr() sometimes returns FALSE instead of an actual timezone: http://bugs.php.net/44780 It's possible to workaround it for some cases by getting the timezone name from timezone_abbreviations_list(). For example, if you have the GMT offset and want a timezone name: <?php /* Takes a GMT offset (in hours) and returns a timezone name */ function tz_offset_to_name($offset) { $offset *= 3600; // convert hour offset to seconds $abbrarray = timezone_abbreviations_list(); foreach ($abbrarray as $abbr) { foreach ($abbr as $city) { if ($city['offset'] == $offset) { return $city['timezone_id']; } } } return FALSE; } ?> ---- Server IP: 208.69.120.35 Probable Submitter: 38.116.136.226 ---- Manual Page -- http://www.php.net/manual/en/function.timezone-name-from-abbr.php Edit -- https://master.php.net/note/edit/86928 Del: integrated -- https://master.php.net/note/delete/86928/integrated Del: useless -- https://master.php.net/note/delete/86928/useless Del: bad code -- https://master.php.net/note/delete/86928/bad+code Del: spam -- https://master.php.net/note/delete/86928/spam Del: non-english -- https://master.php.net/note/delete/86928/non-english Del: in docs -- https://master.php.net/note/delete/86928/in+docs Del: other reasons-- https://master.php.net/note/delete/86928 Reject -- https://master.php.net/note/reject/86928 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#146373) next »