# ISO 8601 with Milliseconds

Key: `datetime.timestamp.iso_8601_milliseconds`

ISO 8601 datetime with 3-digit millisecond precision and UTC indicator. The exact output of JavaScript Date.toISOString() — arguably the most common timestamp format in JSON REST APIs worldwide.

Page: <https://meridian.online/docs/finetype/types/datetime/timestamp/iso_8601_milliseconds>

Format: `%Y-%m-%dT%H:%M:%S.%gZ`

Samples: `2024-01-15T14:30:00.123Z`, `2019-12-31T23:59:59.999Z`, `2023-06-01T00:00:00.000Z`

## Use it

Shell

```shell
finetype infer -i '2024-01-15T14:30:00.123Z' --mode column
# → datetime.timestamp.iso_8601_milliseconds
```

DuckDB

```sql
SELECT ft_infer('2024-01-15T14:30:00.123Z');
-- → 'datetime.timestamp.iso_8601_milliseconds'
```

Cast template: {col} is your column

```sql
strptime({col}, '%Y-%m-%dT%H:%M:%S.%gZ')
-- Format: %Y-%m-%dT%H:%M:%S.%gZ
```

## Background

### Origin

ECMAScript defines a string interchange format for date-times, adapted from the ISO 8601 calendar date extended format and written YYYY-MM-DDTHH:mm:ss.sssZ.[[1]](https://tc39.es/ecma262/multipage/numbers-and-dates.html) In the ECMAScript format, sss is the number of complete milliseconds since the start of the second, written as three decimal digits.[[1]](https://tc39.es/ecma262/multipage/numbers-and-dates.html) ECMAScript's Date.prototype.toISOString returns a date in the Date Time String Format on the UTC time scale, including all format elements and the UTC offset representation "Z".[[1]](https://tc39.es/ecma262/multipage/numbers-and-dates.html)

The first edition of the ISO 8601 standard was published as ISO 8601:1988 in June 1988.[[2]](https://en.wikipedia.org/wiki/ISO_8601) ISO 8601 allows a decimal fraction on the lowest-order time element, separated from it by either a comma or a dot.[[2]](https://en.wikipedia.org/wiki/ISO_8601) In ISO 8601, a time in UTC is marked by adding a Z directly after the time, without a space.[[2]](https://en.wikipedia.org/wiki/ISO_8601) RFC 3339, titled Date and Time on the Internet: Timestamps, was written by G. Klyne and C. Newman and is dated July 2002.[[3]](https://www.rfc-editor.org/rfc/rfc3339.txt) RFC 3339 defines a profile of ISO 8601 for use in Internet protocols.[[3]](https://www.rfc-editor.org/rfc/rfc3339.txt) RFC 3339 defines the suffix Z as denoting a UTC offset of 00:00, often spoken "Zulu" from the ICAO phonetic alphabet.[[3]](https://www.rfc-editor.org/rfc/rfc3339.txt)

### Use

MongoDB's Extended JSON documentation gives 2019-08-11T17:54:14.692Z as an example of a relaxed-mode date.[[4]](https://www.mongodb.com/docs/manual/reference/mongodb-extended-json/) MongoDB Extended JSON v2 says fractional seconds should be omitted when they are zero.[[4]](https://www.mongodb.com/docs/manual/reference/mongodb-extended-json/)

RFC 3339 notes that timestamps in the same time zone, written the same way and with the same number of fractional digits, sort as strings into time order.[[3]](https://www.rfc-editor.org/rfc/rfc3339.txt) A pattern check confirms the shape only; leave it to a real date parser to reject impossible values such as a thirteenth month. (Meridian's view)

### Where you'll meet it

The npm registry's package document for left-pad records the package's creation time as 2014-03-14T09:09:20.762Z.[[5]](https://registry.npmjs.org/left-pad)

## Sources

1. [ECMAScript® 2027 Language Specification](https://tc39.es/ecma262/multipage/numbers-and-dates.html) — standard
2. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) — secondary source
3. [Date and Time on the Internet: Timestamps](https://www.rfc-editor.org/rfc/rfc3339.txt) — standard
4. [MongoDB Extended JSON (v2)](https://www.mongodb.com/docs/manual/reference/mongodb-extended-json/) — documentation
5. [left-pad](https://registry.npmjs.org/left-pad) — dataset

## How it's detected

Highest-impact single addition — covers the entire JavaScript ecosystem. Distinct from iso\_8601 by mandatory 3-digit fractional seconds.
