protected function DateTimeFormatterBase::setTimeZone in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase::setTimeZone()
Sets the proper time zone on a DrupalDateTime object for the current user.
A DrupalDateTime object loaded from the database will have the UTC time zone applied to it. This method will apply the time zone for the current user, based on system and user settings.
Parameters
\Drupal\Core\Datetime\DrupalDateTime $date: A DrupalDateTime object.
See also
4 calls to DateTimeFormatterBase::setTimeZone()
- DateTimeCustomFormatter::settingsSummary in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeCustomFormatter.php - Returns a short summary for the current formatter settings.
- DateTimeCustomFormatter::viewElements in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeCustomFormatter.php - Builds a renderable array for a field value.
- DateTimeDefaultFormatter::viewElements in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeDefaultFormatter.php - Builds a renderable array for a field value.
- DateTimePlainFormatter::viewElements in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimePlainFormatter.php - Builds a renderable array for a field value.
File
- core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeFormatterBase.php, line 147 - Contains \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase.
Class
- DateTimeFormatterBase
- Base class for 'DateTime Field formatter' plugin implementations.
Namespace
Drupal\datetime\Plugin\Field\FieldFormatterCode
protected function setTimeZone(DrupalDateTime $date) {
$date
->setTimeZone(timezone_open(drupal_get_user_timezone()));
}