# WEEKDAY

**The function WEEEKDAY takes a date or a DateTime and returns a number indicating what day of the week the given date falls on.**

This function takes either a single [DateTime](../../variable-data-types/the-datetime-variable-data-type) or a single [date](../../variable-data-types/the-date-variable-data-type) as input. It then returns a number indicating what day of the week the given date falls on. Count starts with 1 and Monday (that is, 1 represents Monday, 2 represents Tuesday, 3 represents Wednesday, et cetera).&#x20;

#### Declaration

```javascript
WEEKDAY(datetime) -> day
```

```javascript
WEEKDAY(date) -> day
```

&#x20;

#### Parameters

**datetime** (type: _DateTime_) Any DateTime.

**date** (type: _date_) Any date.

#### Return Values

**day** (type: _number_) A number (1-7) indicating what day of the week is described by the given date or DateTime. Count starts with 1 and Monday (that is, 1 represents Monday, 2 represents Tuesday, 3 represents Wednesday, et cetera).&#x20;

#### Examples

Assume the first example has access to the following DateTime value:

```javascript
example_date_and_time = {  
 "date": {  
  "day": 1,  
  "month": 4,  
  "year": 2021  
 },  
 "time": {  
  "hour": 16,  
  "minute": 14,  
  "second": 38,  
  "millisecond": 0  
 },  
 "timeZone": "UTC"  
}
```

The date described in **example\_date\_and\_time** is April 1st, 2021. This falls on a Thursday, which WEEKDAY indexes as 4. Thus, in the following example, when **example\_date\_and\_time** is given as input for WEEKDAY, it returns the number 4:

```javascript
WEEKDAY(example_date_and_time) = 4
```

The above example demonstrates how the WEEKDAY function behaves when given a DateTime as input. In order to further establish how the WEEKDAY function behaves when given a date as input, assume the last example has access to the following date value:

```javascript
example_date = {  
 "day": 1,  
 "month": 4,  
 "year": 2021  
}
```

Note that the date described in **example\_date** is identical to the date described in **example\_date\_and\_time**. This is still a Thursday, when **example\_date** is given as input for WEEKDAY, it returns the number 4:

```javascript
WEEKDAY(example_date) = 4
```
