---
title: last_day function
description: Learn the syntax of the last\_day function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/last_day
---

# `last_day` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the last day of the month that the date belongs to.

## Syntax

```
last_day(expr)
```

## Arguments

* `expr`: A `DATE` expression.

## Returns

A `DATE`.

## Examples

```sql
> SELECT last_day('2009-01-12');
 2009-01-31

> SELECT last_day('2009-02-12');
 2009-02-28
```

## Related functions

* [`next_day` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/next_day.md)
