1 date.inc date_day_of_week($date = NULL)

Returns day of week for a given date (0 = Sunday).

Parameters

mixed $date: (optional) A date, default is current local day. Defaults to NULL.

Return value

int: The number of the day in the week.

File

core/includes/date.inc, line 890
Date API functions.

Code

function date_day_of_week($date = NULL) {
  if (empty($date)) {
    $date = date_now();
  }
  elseif (!is_object($date)) {
    $date = new BackdropDateTime($date);
  }

  if (is_object($date)) {
    return $date->format('w');
  }
  return NULL;
}