function DateTimeNormalizer::getNormalizationTimezone

Same name in other branches
  1. 9 core/modules/serialization/src/Normalizer/DateTimeNormalizer.php \Drupal\serialization\Normalizer\DateTimeNormalizer::getNormalizationTimezone()
  2. 8.9.x core/modules/serialization/src/Normalizer/DateTimeNormalizer.php \Drupal\serialization\Normalizer\DateTimeNormalizer::getNormalizationTimezone()
  3. 10 core/modules/serialization/src/Normalizer/DateTimeNormalizer.php \Drupal\serialization\Normalizer\DateTimeNormalizer::getNormalizationTimezone()

Gets the timezone to be used during normalization.

Return value

\DateTimeZone The timezone to use.

See also

::normalize

\Drupal\Core\Datetime\DrupalDateTime::prepareTimezone()

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 75

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.