Loading

ES|QL DATE_PARSE function

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

(Optional) Additional options for date parsing, specifying time zone and locale as function named parameters.

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

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
time_zone
(keyword) Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query string to UTC.
locale

(keyword) The locale to use when parsing the date, relevant when parsing month names or week days.

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