You are here

function date_timezone_abbr in Date 5.2

Same name and namespace in other branches
  1. 6.2 date_api.module \date_timezone_abbr()
  2. 6 date_api.module \date_timezone_abbr()
  3. 7.3 date_api/date_api.module \date_timezone_abbr()
  4. 7 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.module, line 514
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', 'cache');
  $data = unserialize($cached->data);
  if (empty($data) || $refresh) {
    $data = array_keys(timezone_abbreviations_list());
    cache_set('date_timezone_abbreviations', 'cache', serialize($data));
  }
  return $data;
}