> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Dayofweek

# \$dayOfWeek

The `$dayOfWeek` operator extracts the day of the week from a date object (0-6, where 0 is Sunday).

## Input

* A single date object

## Output

* The day of the week as an integer (0-6, where 0 is Sunday)

## Examples

### Extract Day of Week from Date

```json theme={null}
{
  "$dayOfWeek": [
    {
      "$toDate": ["2023-01-15T10:30:00Z"]
    }
  ]
}
```

Result: `0` (Sunday)

### Extract Day of Week from Field

```json theme={null}
{
  "$dayOfWeek": [
    {
      "$input": "event_date"
    }
  ]
}
```

Result: The day of the week (0-6) of the event\_date field
