---
url: /cube-functions/weekdayex.md
description: Returns the day of the week, a number between 1 and 7, from a given date.
---

# WEEKDAYEX&#x20;

Returns the day of the week, a number between 1 and 7, from a given date.

```js
WEEKDAYEX(date, return_type)
```

#### Parameters

* `date` - The date from which to return the day of the week.
* `return_type` - A number that determines the return type based on Excel. `(optional)`

#### Examples

```js
WEEKDAYEX("2022-04-17")

```

**Result:** `1`

**Note:** Returns the day of the week (1) from the given date (2022-04-17), with Sunday as the first day of the week.

```js
WEEKDAYEX(44423, 2)

```

**Result:** `2`

**Note:** Returns the day of the week (2) from the given date (44423), represented as an Excel serial number, with Monday as the first day of the week.
