## DATE_PARSE

DATE_PARSE is a function in ES|QL that allows you to parse a date string using a specified format. This function is useful when you need to convert a string into a date format for further processing or analysis.

### Syntax

`DATE_PARSE(datePattern, dateString)`

#### Parameters

- `datePattern`: The date format. Refer to the DateTimeFormatter documentation for the syntax. If null, the function returns null.
- `dateString`: Date expression as a string. If null or an empty string, the function returns null.

### Examples

Here are a couple of examples of how you can use the DATE_PARSE function in ES|QL queries:

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

In this example, the DATE_PARSE function is used to convert the string "2022-05-06" into a date format using the "yyyy-MM-dd" pattern.

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

In this second example, the DATE_PARSE function is used to convert the string "06-05-2022" into a date format using the "dd-MM-yyyy" pattern.