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

# AggDatetime

The **AggDatetime** function sends a request to execute an aggregate warehouse function that returns a date data type. This function is the aggregate version of [CallDatetime](/docs/calldatetime).

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

```
AggDatetime(function name, arguments...)
```

Function arguments:

* **function name** (required) - an aggregate warehouse function to execute 
* **arguments** (required) - one or more arguments to pass to the warehouse function

All arguments must meet the warehouse function’s input requirements. Unsupported arguments result in an invalid formula.

## Example

A table contains a *Date* column that returns the timestamp of all order transactions for each customer. Using the **AggDatetime** function, you can execute Snowflake's [MAX](https://docs.snowflake.com/en/sql-reference/functions/max) function in a higher grouped level of the table to return the latest timestamp of a customer's shopping history.

```
AggDatetime("MAX", [Date])
```

Returns the most recent date time value from the *Date* column for each customer identified in the *Cust Key* column.

![](https://files.buildwithfern.com/sigma.docs.buildwithfern.com/8e772d1b2a8aa1e079df199d399379c855e823c93ea7f15c439968ef415ed7d6/assets/docs-images/7a9b593-1.png)

## Related resources

* [CallDatetime](/docs/calldatetime)