# TO_DATE_NANOS

Converts an input to a nanosecond-resolution date value (`date_nanos`).

## Syntax

`TO_DATE_NANOS(field)`

### Parameters

#### `field`

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

## Examples

Converting a timestamp string to `date_nanos`

```esql
ROW timestamp = "2023-10-26T12:34:56.123456789Z"
| EVAL nanos_date = TO_DATE_NANOS(timestamp)
```

This example converts a timestamp string into a `date_nanos` value.

Handling values outside the `date_nanos` range

```esql
ROW timestamp = "2500-01-01T00:00:00.000000000Z"
| EVAL nanos_date = TO_DATE_NANOS(timestamp)
```

This example attempts to convert a timestamp outside the valid `date_nanos` range. The result will be `null` with a warning.

## Limitations

- The valid range for `date_nanos` is from `1970-01-01T00:00:00.000000000Z` to `2262-04-11T23:47:16.854775807Z`. Values outside this range will result in `null` and trigger a warning.
- Integer values cannot be converted into `date_nanos` because the range of integer nanoseconds only spans approximately 2 seconds after the epoch.
