You are here

public static function PersianDateHelper::dayOfWeekName in Persian Date for Drupal 8 8

Same name and namespace in other branches
  1. 8.4 src/PersianDateHelper.php \Drupal\persian_date\PersianDateHelper::dayOfWeekName()

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.

Overrides DateHelper::dayOfWeekName

File

src/PersianDateHelper.php, line 508

Class

PersianDateHelper

Namespace

Drupal\persian_date

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];
}