function 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

1 call to Datetime::formatExample()
TimestampDatetimeWidget::formElement in core/lib/Drupal/Core/Datetime/Plugin/Field/FieldWidget/TimestampDatetimeWidget.php

File

core/lib/Drupal/Core/Datetime/Element/Datetime.php, line 394

Class

Datetime
Provides a datetime element.

Namespace

Drupal\Core\Datetime\Element

Code

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.