1 date.inc date_default_timezone($check_user = TRUE)

Returns a timezone name to use as a default.

Parameters

bool $check_user: (optional) Whether or not to check for a user-configured timezone. Defaults to TRUE.

Return value

string The default timezone for a user, if available, otherwise the site.

File

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

Code

function date_default_timezone($check_user = TRUE) {
  global $user;
  if ($check_user && config_get('system.date', 'user_configurable_timezones') && !empty($user->timezone)) {
    return $user->timezone;
  }
  else {
    $default = config_get('system.date', 'default_timezone');
    return empty($default) ? 'UTC' : $default;
  }
}