function date_timezone_abbr in Date 7.2
Same name and namespace in other branches
- 5.2 date_api.module \date_timezone_abbr()
- 6.2 date_api.module \date_timezone_abbr()
- 6 date_api.module \date_timezone_abbr()
- 7.3 date_api/date_api.module \date_timezone_abbr()
- 7 date_api/date_api.module \date_timezone_abbr()
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
- date_api/
date_api.module, line 1752 - This module will make the date API available to other modules.
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;
}