function drupal_get_user_timezone

Returns the time zone of the current user.

8 calls to drupal_get_user_timezone()
DrupalDateTime::prepareTimezone in drupal/core/lib/Drupal/Core/Datetime/DrupalDateTime.php
Overrides prepareTimezone().
DrupalDateTimeTest::testDateTimezone in drupal/core/modules/system/lib/Drupal/system/Tests/Datetime/DrupalDateTimeTest.php
Test that DrupalDateTime can detect the right timezone to use. Test with a variety of less commonly used timezone names to help ensure that the system timezone will be different than the stated timezones.
drupal_session_initialize in drupal/core/includes/session.inc
Initializes the session handler, starting a session if needed.
drupal_session_regenerate in drupal/core/includes/session.inc
Called when an anonymous user becomes authenticated or vice-versa.
FormatDateTest::testFormatDate in drupal/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
Tests the format_date() function.

... See full list

File

drupal/core/includes/bootstrap.inc, line 2196
Functions that need to be loaded on every Drupal request.

Code

function drupal_get_user_timezone() {
  global $user;
  $config = config('system.date');
  if ($config
    ->get('timezone.user.configurable') && $user->uid && $user->timezone) {
    return $user->timezone;
  }
  else {

    // Ignore PHP strict notice if time zone has not yet been set in the php.ini
    // configuration.
    $config_data_default_timezone = $config
      ->get('timezone.default');
    return !empty($config_data_default_timezone) ? $config_data_default_timezone : @date_default_timezone_get();
  }
}