Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Ftime%2Ftoiso8601datetime.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Ftime%2Ftoiso8601datetime.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `toIso8601DateTime`

Warning

`toIso8601DateTime` is deprecated.

<!-- -->

<!-- -->

Use [\`formatTimestamp\`](https://docs-docusaurus.kinsta.page/dataprime/language-reference/functions-reference/time/formattimestamp/.md) instead.

## Description

Returns a timestamp formatted as an ISO 8601 string (e.g. `2023-08-11T07:29:17.634Z`). This function supports nanosecond precision.

## Syntax

Like many functions in DataPrime, `toIso8601DateTime` supports<!-- --> [two notations](https://docs-docusaurus.kinsta.page/dataprime/language-reference/functions-reference/.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

```
toIso8601DateTime(timestamp: timestamp): string
```

```
(timestamp: timestamp).toIso8601DateTime(): string
```

## Arguments

| Name        | Type        | Required | Description                         |
| ----------- | ----------- | -------- | ----------------------------------- |
| `timestamp` | `timestamp` | **true** | The timestamp to format in ISO 8601 |

## Example

**Use case: Convert a timestamp into ISO 8601 format**

### Example query

* Function notation
* Method notation

```
create formatted_ts from toIso8601DateTime($m.timestamp)
```

```
create formatted_ts from $m.timestamp.toIso8601DateTime()
```

### Example output

```
{

  "formatted_ts": "2023-08-11T07:29:17.634Z"

}
```
