1 date.inc date_get_timezone_db($handling, $timezone = NULL)

Function to figure out which DB timezone applies to a date.

Parameters

string $handling: The timezone handling.

string $timezone: (optional) When $handling is 'date', date_get_timezone_db() returns this value.

Return value

string: The timezone string.

File

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

Code

function date_get_timezone_db($handling, $timezone = NULL) {
  switch ($handling) {
    case ('utc'):
    case ('site'):
    case ('user'):
      // These handling modes all convert to UTC before storing in the DB.
      $timezone = 'UTC';
      break;

    case ('date'):
      if ($timezone == NULL) {
        // This shouldn't happen, since it's meaning is undefined. But we need
        // to fall back to *something* that's a legal timezone.
        $timezone = date_default_timezone();
      }
      break;

    case ('none'):
    default:
      $timezone = date_default_timezone();
      break;
  }
  return $timezone;
}