# TO_DATETIME

The TO_DATETIME function converts an input value into a date value.

## Syntax

`TO_DATETIME(field)`

### Parameters

#### field

The input value to be converted. This can be a single or multi-valued column or an expression.

## Examples

The following example converts a string into a date value:

```esql
ROW string = ["1953-09-02T00:00:00.000Z", "1964-06-02T00:00:00.000Z", "1964-06-02 00:00:00"]
| EVAL datetime = TO_DATETIME(string)
```

If the input parameter is of a numeric type, its value will be interpreted as milliseconds since the Unix epoch. For example:

```esql
ROW int = [0, 1]
| EVAL dt = TO_DATETIME(int)
```

## Notes

- TO_DATETIME converts an input value into a date value. A string will only be successfully converted if it follows the format `yyyy-MM-dd'T'HH:mm:ss.SSS'Z'`. To convert dates in other formats, use the `DATE_PARSE` function.

- When converting from nanosecond resolution to millisecond resolution with this function, the nanosecond date is truncated, not rounded.
