You are here

function date_timezone_options in Date 5

Time zone option list

Parameters

$limit - an optional offset value, to limit the results to timezones that match that offset:

Return value

array of timezone ids (i.e. US/Eastern, US/Central)

2 calls to date_timezone_options()
date_field_settings_form in ./date_admin.inc
date_timezone_input in ./date.inc
Timezone input form

File

./date.inc, line 571
Date/time API functions

Code

function date_timezone_options($limit = '') {
  include_once './' . drupal_get_path('module', 'date_api') . '/date_timezones.inc';
  $zonelist = array();
  if (!$limit) {
    $zonelist = drupal_map_assoc(date_zonelist());
  }
  else {
    $zones = date_get_timezones();
    foreach ($zones as $zone) {
      if ($zone['offset'] == $limit || $zone['offset_dst'] == $limit) {
        $zonelist[$zone['timezone']] = $zone['timezone'];
      }
    }
  }
  $zonelist += array(
    'GMT' => 'GMT',
  );
  asort($zonelist);
  return $zonelist;
}