You are here

public static function DateHelper::ampm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Datetime/DateHelper.php \Drupal\Core\Datetime\DateHelper::ampm()

Constructs an array of AM and PM options.

Parameters

bool $required: (optional) If FALSE, the returned array will include a blank value. Defaults to FALSE.

Return value

array An array of AM and PM options.

File

core/lib/Drupal/Core/Datetime/DateHelper.php, line 440
Contains \Drupal\Core\Datetime\DateHelper.

Class

DateHelper
Defines Gregorian Calendar date values.

Namespace

Drupal\Core\Datetime

Code

public static function ampm($required = FALSE) {
  $none = array(
    '' => '',
  );
  $ampm = array(
    'am' => t('am', array(), array(
      'context' => 'ampm',
    )),
    'pm' => t('pm', array(), array(
      'context' => 'ampm',
    )),
  );
  return !$required ? $none + $ampm : $ampm;
}