DateHelper::monthNamesAbbr

public static DateHelper::monthNamesAbbr($required = FALSE)

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 112

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;
}
doc_Drupal
2016-10-29 09:00:50
Comments
Leave a Comment

Please login to continue.