1 date.inc 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.

File

core/includes/date.inc, line 1365
Date API functions.

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