﻿---
title: ES|QL RANGE_MAX function
description: 
url: https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/152901/reference/query-languages/esql/functions-operators/date-time-functions/range_max
products:
  - Elasticsearch
---

# ES|QL RANGE_MAX function
<applies-to>
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Planned
</applies-to>

Returns the end value of a date range.

## Syntax

![Embedded](https://docs-v3-preview.elastic.dev/elastic/elasticsearch/pull/152901/reference/query-languages/esql/images/generated/x-pack-esql/functions/range_max.svg)


## Parameters

<definitions>
  <definition term="range">
    Date range expression. If `null`, the function returns `null`.
  </definition>
</definitions>


## Description

Returns the maximum (end) value of a date_range. For a date_range x, y), it returns y.

## Supported types


| range                                                      | result |
|------------------------------------------------------------|--------|
| date_range <applies-to>Elastic Stack: Planned</applies-to> | date   |


## Example

```esql
FROM decades
| WHERE decade == 1900
| EVAL max_bound = RANGE_MAX(date_range)
| KEEP date_range, max_bound
```


| date_range:date_range  | max_bound:date           |
|------------------------|--------------------------|
| 1900-01-01..1910-01-01 | 1910-01-01T00:00:00.000Z |