function date_get_timezone

nittany7 date_api.module date_get_timezone($handling, $timezone = '')
cis7 date_api.module date_get_timezone($handling, $timezone = '')
mooc7 date_api.module date_get_timezone($handling, $timezone = '')

Function to figure out which local timezone applies to a date and select it.

Parameters

string $handling: The timezone handling.

string $timezone: (optional) A timezone string. Defaults to an empty string.

Return value

string The timezone string.

16 calls to date_get_timezone()
date_context_date_condition::execute in modules/contrib/date/date_context/plugins/date_context_date_condition.inc
date_default_value in modules/contrib/date/date_elements.inc
The callback for setting a default value for an empty date field.
date_default_value_part in modules/contrib/date/date_elements.inc
Helper function for the date default value callback to set either 'value' or 'value2' to its default value.
date_devel_generate in modules/contrib/date/date.devel_generate.inc
Implements hook_devel_generate().
date_field_get_sql_handler in modules/contrib/date/date.module
Generates a Date API SQL handler for the given date field.

... See full list

File

modules/contrib/date/date_api/date_api.module, line 2308
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_get_timezone($handling, $timezone = '') {
  switch ($handling) {
    case 'date':
      $timezone = !empty($timezone) ? $timezone : date_default_timezone();
      break;
    case 'utc':
      $timezone = 'UTC';
      break;
    default:
      $timezone = date_default_timezone();
  }
  return $timezone > '' ? $timezone : date_default_timezone();
}