# DAY

**The function DAY returns the value of the day in a Date or DateTime.**

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](../../variable-data-types/the-number-variable-data-type): the value of the day in the given [Time](../../variable-data-types/the-time-variable-data-type) or a [DateTime](../../variable-data-types/the-datetime-variable-data-type).

#### Declaration

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

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

&#x20;

#### Parameters

**datetime** (type: _DateTime_) Any DateTime. This is what describes the day value that the DAY function will return.

**date** (type: _Date_) Any Date. This is what describes the day value that the DAY function will return.

#### Return Values

**day** (type: _Number_) The month value from the given Date or DateTime.

#### 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 following example retrieves the day described in the DateTime **example\_date\_and\_time**. Note how the output matches the day given in the above variable:

```javascript
DAY(example_date_and_time) = 1
```

The above example demonstrates how the DAY function behaves when given a DateTime as input. In order to further establish how the DAY 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  
}
```

The following example retrieves the month described in the DateTime **example\_date**. Note that the date described in **example\_date** is identical to the date described in **example\_date\_and\_time**, and that DAY returns the same value when given either as input:

```javascript
DAY(example_date) = 1
```
