protected function DrupalDateTime::prepareTimezone

Overrides prepareTimezone().

Override basic component timezone handling to use Drupal's knowledge of the preferred user timezone.

Overrides DateTimePlus::prepareTimezone

File

drupal/core/lib/Drupal/Core/Datetime/DrupalDateTime.php, line 77
Definition of Drupal\Core\Datetime\DrupalDateTime.

Class

DrupalDateTime
Extends DateTimePlus().

Namespace

Drupal\Core\Datetime

Code

protected function prepareTimezone($timezone) {
  $user_timezone = drupal_get_user_timezone();
  if (empty($timezone) && !empty($user_timezone)) {
    $timezone = $user_timezone;
  }
  parent::prepareTimezone($timezone);
}