# ISO with Space Separator and Z

Key: `datetime.timestamp.iso_space_zulu`

RFC 3339 variant using space instead of T separator with UTC Z indicator. SQLite datetime('now') output and some cloud service log formats.

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

Format: `%Y-%m-%d %H:%M:%SZ`

Samples: `2024-01-15 14:30:00Z`, `2023-12-31 23:59:59Z`, `2024-06-01 00:00:00Z`

## Use it

Shell

```shell
finetype infer -i '2024-01-15 14:30:00Z' --mode column
# → datetime.timestamp.iso_space_zulu
```

DuckDB

```sql
SELECT ft_infer('2024-01-15 14:30:00Z');
-- → 'datetime.timestamp.iso_space_zulu'
```

Cast template: {col} is your column

```sql
strptime({col}, '%Y-%m-%d %H:%M:%SZ')
-- Format: %Y-%m-%d %H:%M:%SZ
```

## Background

### Origin

RFC 3339, Date and Time on the Internet: Timestamps, was published in July 2002 by G. Klyne and C. Newman.[[1]](https://www.rfc-editor.org/rfc/rfc3339) RFC 3339 defines a date and time format for Internet protocols as a profile of the ISO 8601 standard.[[1]](https://www.rfc-editor.org/rfc/rfc3339) RFC 3339's grammar joins the full date and the full time with the letter T.[[1]](https://www.rfc-editor.org/rfc/rfc3339) A note in RFC 3339 says applications may choose, for the sake of readability, to separate the full date and full time with a space character instead.[[1]](https://www.rfc-editor.org/rfc/rfc3339) ISO 8601 itself does not allow a space between the date and time parts.[[2]](https://en.wikipedia.org/wiki/ISO_8601)

RFC 3339 defines Z as a suffix that, applied to a time, denotes a UTC offset of 00:00.[[1]](https://www.rfc-editor.org/rfc/rfc3339) The Z suffix in ISO 8601 times is sometimes called Zulu time.[[2]](https://en.wikipedia.org/wiki/ISO_8601) RFC 3339 says a Z or +00:00 offset implies that UTC is the preferred reference point for the time, which differs from an offset of -00:00, meaning the UTC time is known but the local offset is not.[[1]](https://www.rfc-editor.org/rfc/rfc3339) RFC 3339 permits a lower-case z but says applications that generate the format should use upper-case letters.[[1]](https://www.rfc-editor.org/rfc/rfc3339)

### Use

Elixir's DateTime.to\_string renders a UTC datetime in this shape, with 2000-02-29 23:00:07Z as its documented example.[[3]](https://elixir.hexdocs.pm/DateTime.html) Elixir's DateTime.to\_iso8601 writes the same UTC moment with a T separator, as 2000-02-29T23:00:07Z.[[3]](https://elixir.hexdocs.pm/DateTime.html) A file built from one Elixir application can therefore hold both spellings of the same instant, depending on which function wrote each column. (Meridian's view)

SQLite's date and time functions accept a time value followed by a timezone indicator of the form \[+-\]HH:MM or just Z.[[4]](https://sqlite.org/lang_datefunc.html) SQLite's documentation says its date and time functions use UTC internally, so the Z suffix is a no-op.[[4]](https://sqlite.org/lang_datefunc.html) Python's datetime.fromisoformat documentation says the T separator may be replaced by any single unicode character.[[5]](https://docs.python.org/3/library/datetime.html) Python's datetime.fromisoformat documentation gives 2011-11-04T00:05:23Z as an example that parses to a datetime in UTC.[[5]](https://docs.python.org/3/library/datetime.html)

The Z is the whole value of this format: it is the only thing that tells you the clock reading is UTC rather than some unstated local time. (Meridian's view) If your parser matches the Z as a literal and returns a timestamp without a time zone, record that the column is UTC, or convert it to a time-zone-aware type straight away, so the meaning is not lost at the next join. (Meridian's view)

## Sources

1. [RFC 3339: Date and Time on the Internet: Timestamps](https://www.rfc-editor.org/rfc/rfc3339) — standard
2. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) — secondary source
3. [DateTime (Elixir v1.20.4)](https://elixir.hexdocs.pm/DateTime.html) — documentation
4. [Date And Time Functions](https://sqlite.org/lang_datefunc.html) — documentation
5. [datetime — Basic date and time types](https://docs.python.org/3/library/datetime.html) — documentation

## How it's detected

RFC 3339 permits space instead of T. SQLite datetime('now'), AWS CloudWatch, GCP logs.
