> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# LastDay

> Use the Sigma LastDay function to evaluate a specified date component (i.e., year, quarter, month, or week) in a date value and return the last.

The **LastDay** function evaluates a specified date component (i.e., year, quarter, month, or week) in a date value and returns the last date and time in that component as a timestamp.

This function isn't compatible with all data platform connections. To check if your connection supports it, see [Supported data platforms and feature compatibility](/docs/region-warehouse-and-feature-support#supported-data-platforms-and-feature-compatibility).

## Syntax

`LastDay(date, precision)`

Function arguments:

* **date** (required) - the date or column containing date values from which the date component is extracted
* **precision** (required) - the date component (i.e., year, quarter, month, or week) evaluated for its last date and time

## Examples

```
LastDay([Invoice Date], "month")
```

Extracts the month component from the date in the *Invoice Date* column and returns the last date and time for that month.

![](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sigma.docs.buildwithfern.com/376b5960e0425048b73ff32f8588abbeffdbdbe3be2dc118fce33d07d19ffebd/assets/docs-images/e6bae8e-1.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260725%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260725T034124Z&X-Amz-Expires=604800&X-Amz-Signature=7e78ba73586e153b5f8478b2ddad4e935bce5601e6fc03229f36c8d8bc2025a7&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

```
LastDay(Date("2020-01-10 10:34:29"), "year")
```

Extracts the year component from the specified date (January 10, 2020) and returns the last date and time for that year.

![](https://fdr-prod-docs-files-public.s3.us-east-1.amazonaws.com/sigma.docs.buildwithfern.com/f0122f66ca34860fb65a1a2195e4891271504b3d6e96faed99960eb5949aed9d/assets/docs-images/2ec753f-2.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA6KXJSKKNFOCF7G4B%2F20260725%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20260725T034124Z&X-Amz-Expires=604800&X-Amz-Signature=e048c8d6aa776975bcfa541610b489e538b4304683544224b1310236c26d74ea&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject)

## Related resources

* [DatePart](/docs/datepart)
* <a href="https://quickstarts.sigmacomputing.com/guide/common_date_functions/index.html" target="_blank" rel="noopener noreferrer">
    Quickstart: Common date functions and use cases
  </a>