1.20.x date.inc | date_timezone_abbr($refresh = FALSE) |
Returns an array of system-allowed timezone abbreviations.
Cache an array of just the abbreviation names because the whole timezone_abbreviations_list() is huge, so we don't want to retrieve it more than necessary.
Parameters
bool $refresh: (optional) Whether to refresh the list. Defaults to TRUE.
Return value
array: An array of allowed timezone abbreviations.
File
- includes/
date.inc, line 592 - Date API functions and constants.
Code
function date_timezone_abbr($refresh = FALSE) {
$cached = cache_get('date_timezone_abbreviations');
$data = isset($cached->data) ? $cached->data : array();
if (empty($data) || $refresh) {
$data = array_keys(timezone_abbreviations_list());
cache_set('date_timezone_abbreviations', $data);
}
return $data;
}