public static function DateHelper::dayOfWeekName

public static DateHelper::dayOfWeekName($date = NULL, $abbr = TRUE)

Returns translated name of the day of week for a given date.

Parameters

mixed $date: (optional) A DrupalDateTime object or a date string. Defaults to NULL, which means use the current date.

string $abbr: (optional) Whether to return the abbreviated name for that day. Defaults to TRUE.

Return value

string The name of the day in the week for that date.

File

core/lib/Drupal/Core/Datetime/DateHelper.php, line 524

Class

DateHelper
Defines Gregorian Calendar date values.

Namespace

Drupal\Core\Datetime

Code

public static function dayOfWeekName($date = NULL, $abbr = TRUE) {
  if (!$date instanceof DrupalDateTime) {
    $date = new DrupalDateTime($date);
  }
  $dow = self::dayOfWeek($date);
  $days = $abbr ? self::weekDaysAbbr() : self::weekDays();
  return $days[$dow];
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Datetime!DateHelper.php/function/DateHelper::dayOfWeekName/8.1.x