public function TimeZoneResolver::setDefaultTimeZone in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/src/TimeZoneResolver.php \Drupal\system\TimeZoneResolver::setDefaultTimeZone()
- 10 core/modules/system/src/TimeZoneResolver.php \Drupal\system\TimeZoneResolver::setDefaultTimeZone()
Sets the default time zone.
1 call to TimeZoneResolver::setDefaultTimeZone()
- TimeZoneResolver::onConfigSave in core/
modules/ system/ src/ TimeZoneResolver.php - Updates the default time zone when time zone config changes.
File
- core/
modules/ system/ src/ TimeZoneResolver.php, line 52
Class
- TimeZoneResolver
- Event handler that resolves time zone based on site and user configuration.
Namespace
Drupal\systemCode
public function setDefaultTimeZone() {
if ($time_zone = $this
->getTimeZone()) {
date_default_timezone_set($time_zone);
}
}