You are here

function date_get_timezone in Date 7.2

Same name and namespace in other branches
  1. 8 date_api/date_api.module \date_get_timezone()
  2. 5.2 date_api.module \date_get_timezone()
  3. 5 date.inc \date_get_timezone()
  4. 6.2 date_api.module \date_get_timezone()
  5. 6 date/date.module \date_get_timezone()
  6. 7.3 date_api/date_api.module \date_get_timezone()
  7. 7 date_api/date_api.module \date_get_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 date_context/plugins/date_context_date_condition.inc
date_default_value in ./date_elements.inc
The callback for setting a default value for an empty date field.
date_default_value_part in ./date_elements.inc
Default value callback to set either 'value', 'value2' to its default value.
date_devel_generate in ./date.devel_generate.inc
Implements hook_devel_generate().
date_field_get_sql_handler in ./date.module
Generates a Date API SQL handler for the given date field.

... See full list

File

date_api/date_api.module, line 2650
This module will make the date API available to other modules.

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