W3cubDocs

/Drupal 8

public static function Datetime::formatExample

public static Datetime::formatExample($format)

Creates an example for a date format.

This is centralized for a consistent method of creating these examples.

Parameters

string $format:

Return value

string

File

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

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);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Datetime!Element!Datetime.php/function/Datetime::formatExample/8.1.x