function drupal_get_user_timezone

Returns the time zone of the current user.

15 calls to drupal_get_user_timezone()
DateTimeDatelistWidget::formElement in drupal/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDatelistWidget.php
Implements \Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
DateTimeDefaultFormatter::viewElements in drupal/core/modules/datetime/lib/Drupal/datetime/Plugin/field/formatter/DatetimeDefaultFormatter.php
Builds a renderable array for a field value.
DateTimeDefaultWidget::formElement in drupal/core/modules/datetime/lib/Drupal/datetime/Plugin/field/widget/DatetimeDefaultWidget.php
Implements \Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
DateTimePlainFormatter::viewElements in drupal/core/modules/datetime/lib/Drupal/datetime/Plugin/field/formatter/DatetimePlainFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements().
datetime_datelist_form_process in drupal/core/modules/datetime/datetime.module
Expands a date element into an array of individual elements.

... See full list

File

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

Code

function drupal_get_user_timezone() {
  global $user;
  $config = config('system.timezone');
  if ($config
    ->get('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('default');
    return !empty($config_data_default_timezone) ? $config_data_default_timezone : @date_default_timezone_get();
  }
}