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.


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_default_value in modules/contrib/date/
The callback for setting a default value for an empty date field.
date_default_value_part in modules/contrib/date/
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/
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


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.


function date_get_timezone($handling, $timezone = '') {
  switch ($handling) {
    case 'date':
      $timezone = !empty($timezone) ? $timezone : date_default_timezone();
    case 'utc':
      $timezone = 'UTC';
      $timezone = date_default_timezone();
  return $timezone > '' ? $timezone : date_default_timezone();