> ## 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.

# LAST_DAY

> Returns the last calendar date of the input month.

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

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

NULL value yields NULL. Unrepresentable calendar dates raise an error.

## Syntax

### Scalar

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

## Arguments

| Name | Type | Required | Description |
| - | - | - | - |
| value | DATE or TIMESTAMP | Yes | Date whose month end is selected. |

## Returns

* Type: DATE
* NULL behavior: NULL value yields NULL. Unrepresentable calendar dates raise an error.

## Properties

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

## Usage notes

* Inputs are converted to DATE before finding the last day of the month.

## Examples

### Basic example

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

| result |
| - |
| 2024-02-29 |

### Leap years and ordinary years

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT last_day(DATE '2023-02-15') AS ordinary_year, last_day(DATE '2024-02-15') AS leap_year;
```

| ordinary\_year | leap\_year |
| - | - |
| 2023-02-28 | 2024-02-29 |

## Limitations

* Use DATE values or the TIMESTAMP conversions shown here. TIME inputs are outside these forms.


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