﻿---
title: ES|QL DATE_PARSE function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/3016/reference/query-languages/esql/functions-operators/date-time-functions/date_parse
products:
  - Elasticsearch
---

# ES|QL DATE_PARSE function
## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/3016/reference/query-languages/esql/images/functions/date_parse.svg)


## Parameters

<definitions>
  <definition term="datePattern">
    The date format. Refer to the [`DateTimeFormatter` documentation](https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/time/format/DateTimeFormatter.html) for the syntax. If `null`, the function returns `null`.
  </definition>
  <definition term="dateString">
    Date expression as a string. If `null` or an empty string, the function returns `null`.
  </definition>
  <definition term="options">
    (Optional) Additional options for date parsing, specifying time zone and locale as [function named parameters](/elastic/docs-builder/docs/3016/reference/query-languages/esql/esql-syntax#esql-function-named-params).
  </definition>
</definitions>


## Description

Returns a date by parsing the second argument using the format specified in the first argument.

## Supported types


| datePattern | dateString | options          | result |
|-------------|------------|------------------|--------|
| keyword     | keyword    | named parameters | date   |
| keyword     | keyword    |                  | date   |
| keyword     | text       | named parameters | date   |
| keyword     | text       |                  | date   |
| text        | keyword    | named parameters | date   |
| text        | keyword    |                  | date   |
| text        | text       | named parameters | date   |
| text        | text       |                  | date   |
|             | keyword    | named parameters | date   |
|             | keyword    |                  | date   |
|             | text       | named parameters | date   |
|             | text       |                  | date   |


### Supported function named parameters

<definitions>
  <definition term="time_zone">
    (keyword) Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query string to UTC.
  </definition>
  <definition term="locale">
    (keyword) The locale to use when parsing the date, relevant when parsing month names or week days.
  </definition>
</definitions>


## Example

```esql
ROW date_string = "2022-05-06"
| EVAL date = DATE_PARSE("yyyy-MM-dd", date_string)
```


| date_string:keyword | date:date                |
|---------------------|--------------------------|
| 2022-05-06          | 2022-05-06T00:00:00.000Z |