You are here

public static function DateHelper::weekDays in Zircon Profile 8.0

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

Returns a translated array of week names.

Parameters

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

Return value

array An array of week day names

1 call to DateHelper::weekDays()
DateHelper::dayOfWeekName in core/lib/Drupal/Core/Datetime/DateHelper.php
Returns translated name of the day of week for a given date.

File

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

Class

DateHelper
Defines Gregorian Calendar date values.

Namespace

Drupal\Core\Datetime

Code

public static function weekDays($required = FALSE) {
  $weekdays = array(
    t('Sunday'),
    t('Monday'),
    t('Tuesday'),
    t('Wednesday'),
    t('Thursday'),
    t('Friday'),
    t('Saturday'),
  );
  $none = array(
    '' => '',
  );
  return !$required ? $none + $weekdays : $weekdays;
}