## DATE_FORMAT

The `DATE_FORMAT` function in ES|QL is used to return a string representation of a date, in the provided format. If no format is specified, the `yyyy-MM-dd'T'HH:mm:ss.SSSZ` format is used. 

### Syntax

`DATE_FORMAT(dateFormat, date)`

#### Parameters

- `dateFormat`: Date format (optional). If no format is specified, the `yyyy-MM-dd'T'HH:mm:ss.SSSZ` format is used. If null, the function returns null.
- `date`: Date expression. If null, the function returns null.

### Examples

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

```esql
FROM employees
| KEEP first_name, last_name, hire_date
| EVAL hired = DATE_FORMAT("YYYY-MM-dd", hire_date)
```

In this example, the `DATE_FORMAT` function is used to format the `hire_date` field in the "YYYY-MM-dd" format.

```esql
FROM logs-*
| WHERE @timestamp <= NOW()
| EVAL log_date = DATE_FORMAT("YYYY-MM-dd HH:mm:ss", @timestamp)
```

In this second example, the `DATE_FORMAT` function is used to format the `@timestamp` field in the "YYYY-MM-dd HH:mm:ss" format.