function datetime_format_example

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_format_example()
datetime_datetime_form_process in drupal/core/modules/datetime/datetime.module
Expands a #datetime element type into date and/or time elements.
datetime_datetime_validate in drupal/core/modules/datetime/datetime.module
Validation callback for a datetime element.
datetime_form_node_form_alter in drupal/core/modules/datetime/datetime.module
Implements hook_form_BASE_FORM_ID_alter() for node forms.

File

drupal/core/modules/datetime/datetime.module, line 744
Field hooks to implement a simple datetime field.

Code

function datetime_format_example($format) {
  $date =& drupal_static(__FUNCTION__);
  if (empty($date)) {
    $date = new DrupalDateTime();
  }
  return $date
    ->format($format);
}