You are here

function date_timezone_abbr in Date 7

Same name and namespace in other branches
  1. 5.2 date_api.module \date_timezone_abbr()
  2. 6.2 date_api.module \date_timezone_abbr()
  3. 6 date_api.module \date_timezone_abbr()
  4. 7.3 date_api/date_api.module \date_timezone_abbr()
  5. 7.2 date_api/date_api.module \date_timezone_abbr()

An array of timezone abbreviations that the system allows. Cache an array of just the abbreviation names because the whole timezone_abbreviations_list is huge so we don't want to get it more than necessary.

Return value

array

File

date_api/date_api.module, line 1148
This module will make the date API available to other modules. Designed to provide a light but flexible assortment of functions and constants, with more functionality in additional files that are not loaded unless other modules specifically include them.

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;
}