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

# DAY

> Extracts the day-of-month component.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Scalar function</span></div>

**Aliases:** [`days`](/query/sql/functions/date-time/days)

Returns NULL for NULL input. Some date/time components also return NULL when the input is outside their supported calendar range.

## Syntax

### Day form (scalar)

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
day(value)
```

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | DATE or TIMESTAMP | Yes | Temporal value whose component is extracted. |

## Returns

* Type: INTEGER
* Possible values: 1 through 31
* NULL behavior: Returns NULL for NULL input. Some date/time components also return NULL when the input is outside their supported calendar range.

## Properties

| Property | Value |
| - | - |
| Deterministic | Yes |
| Exact result | Yes |

## Usage notes

* Returns an INTEGER component, or NULL for a NULL input.
* DAY is an alias of DAYS. Both take one DATE or TIMESTAMP argument.

## Examples

### Extract a component

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT day(DATE '2024-03-15') AS result;
```

| result |
| - |
| 15 |

### NULL input

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT day(CAST(NULL AS TIMESTAMP)) AS result;
```

| result |
| - |
| NULL |

## Limitations

* String inputs require conversion to a date or timestamp. Use the formats shown here; the example does not cover every date or time format.
* Inputs outside the supported calendar range can return NULL. YEAR and MONTH support a wider range than other fields.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.