You are here

protected function DateTimeNormalizer::getNormalizationTimezone in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/serialization/src/Normalizer/DateTimeNormalizer.php \Drupal\serialization\Normalizer\DateTimeNormalizer::getNormalizationTimezone()

Gets the timezone to be used during normalization.

@returns \DateTimeZone The timezone to use.

See also

::normalize

1 method overrides DateTimeNormalizer::getNormalizationTimezone()
TimestampNormalizer::getNormalizationTimezone in core/modules/serialization/src/Normalizer/TimestampNormalizer.php
Gets the timezone to be used during normalization.

File

core/modules/serialization/src/Normalizer/DateTimeNormalizer.php, line 81

Class

DateTimeNormalizer
Converts values for datetime objects to RFC3339 and from common formats.

Namespace

Drupal\serialization\Normalizer

Code

protected function getNormalizationTimezone() {
  $default_site_timezone = $this->systemDateConfig
    ->get('timezone.default');
  return new \DateTimeZone($default_site_timezone);
}