public static function Datetime::formatExample in Drupal 9
Same name and namespace in other branches
- 8 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:
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 393
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);
}