function Datetime::formatExample
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Datetime/Element/Datetime.php \Drupal\Core\Datetime\Element\Datetime::formatExample()
- 10 core/lib/Drupal/Core/Datetime/Element/Datetime.php \Drupal\Core\Datetime\Element\Datetime::formatExample()
Creates an example for a date format.
This is centralized for a consistent method of creating these examples.
Parameters
string $format: The date format.
Return value
string
3 calls to Datetime::formatExample()
- Datetime::processDatetime in core/
lib/ Drupal/ Core/ Datetime/ Element/ Datetime.php - Expands a datetime element type into date and/or time elements.
- Datetime::validateDatetime in core/
lib/ Drupal/ Core/ Datetime/ Element/ Datetime.php - Validation callback for a datetime element.
- TimestampDatetimeWidget::formElement in core/
lib/ Drupal/ Core/ Datetime/ Plugin/ Field/ FieldWidget/ TimestampDatetimeWidget.php - Returns the form for a single field widget.
File
-
core/
lib/ Drupal/ Core/ Datetime/ Element/ Datetime.php, line 394
Class
- Datetime
- Provides a datetime element.
Namespace
Drupal\Core\Datetime\ElementCode
public static function formatExample($format) {
if (!static::$dateExample) {
static::$dateExample = new DrupalDateTime();
}
return static::$dateExample->format($format);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.