You are here

public static function DateHelper::monthNamesAbbr 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::monthNamesAbbr()

Constructs a translated array of month name abbreviations

Parameters

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

Return value

array An array of month abbreviations.

File

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

Class

DateHelper
Defines Gregorian Calendar date values.

Namespace

Drupal\Core\Datetime

Code

public static function monthNamesAbbr($required = FALSE) {

  // Force the key to use the correct month value, rather than
  // starting with zero.
  $monthnames = array(
    1 => t('Jan', array(), array(
      'context' => 'Abbreviated month name',
    )),
    2 => t('Feb', array(), array(
      'context' => 'Abbreviated month name',
    )),
    3 => t('Mar', array(), array(
      'context' => 'Abbreviated month name',
    )),
    4 => t('Apr', array(), array(
      'context' => 'Abbreviated month name',
    )),
    5 => t('May', array(), array(
      'context' => 'Abbreviated month name',
    )),
    6 => t('Jun', array(), array(
      'context' => 'Abbreviated month name',
    )),
    7 => t('Jul', array(), array(
      'context' => 'Abbreviated month name',
    )),
    8 => t('Aug', array(), array(
      'context' => 'Abbreviated month name',
    )),
    9 => t('Sep', array(), array(
      'context' => 'Abbreviated month name',
    )),
    10 => t('Oct', array(), array(
      'context' => 'Abbreviated month name',
    )),
    11 => t('Nov', array(), array(
      'context' => 'Abbreviated month name',
    )),
    12 => t('Dec', array(), array(
      'context' => 'Abbreviated month name',
    )),
  );
  $none = array(
    '' => '',
  );
  return !$required ? $none + $monthnames : $monthnames;
}