function DateTestBase::setSiteTimezone
Same name in this branch
- 8.9.x core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::setSiteTimezone()
Same name in other branches
- 9 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::setSiteTimezone()
- 10 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::setSiteTimezone()
- 11.x core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::setSiteTimezone()
Sets the site timezone to a given timezone.
Parameters
string $timezone: The timezone identifier to set.
File
-
core/
modules/ datetime/ src/ Tests/ DateTestBase.php, line 184
Class
- DateTestBase
- Provides a base class for testing Datetime field functionality.
Namespace
Drupal\datetime\TestsCode
protected function setSiteTimezone($timezone) {
// Set an explicit site timezone, and disallow per-user timezones.
$this->config('system.date')
->set('timezone.user.configurable', 0)
->set('timezone.default', $timezone)
->save();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.