function DateTimeDefaultFormatter::formatDate
Same name in other branches
- 9 core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeDefaultFormatter::formatDate()
- 8.9.x core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeDefaultFormatter::formatDate()
- 11.x core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeDefaultFormatter.php \Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeDefaultFormatter::formatDate()
Overrides DateTimeFormatterBase::formatDate
1 call to DateTimeDefaultFormatter::formatDate()
- DateTimeDefaultFormatter::settingsSummary in core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeDefaultFormatter.php - Returns a short summary for the current formatter settings.
File
-
core/
modules/ datetime/ src/ Plugin/ Field/ FieldFormatter/ DateTimeDefaultFormatter.php, line 34
Class
- DateTimeDefaultFormatter
- Plugin implementation of the 'Default' formatter for 'datetime' fields.
Namespace
Drupal\datetime\Plugin\Field\FieldFormatterCode
protected function formatDate($date) {
$format_type = $this->getSetting('format_type');
$timezone = $this->getSetting('timezone_override') ?: $date->getTimezone()
->getName();
return $this->dateFormatter
->format($date->getTimestamp(), $format_type, '', $timezone != '' ? $timezone : NULL);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.