ISO 8601 Compact
datetime.timestamp.iso_8601_compactCompact ISO 8601 without separators. Common in filenames, log identifiers, and systems with character constraints.
Operations on this type: Parse a date or time
Try a value
ISO 8601 Compact's rule accepts it.
Reads it as 2024-03-04 05:06:07
Use it
finetype infer -i '20240115T103000' --mode column
# → datetime.timestamp.iso_8601_compactSELECT ft_infer('20240115T103000');
-- → 'datetime.timestamp.iso_8601_compact'strptime({col}, '%Y%m%dT%H%M%S')
-- Format: %Y%m%dT%H%M%SHow finetype reads the samples
DuckDB 1.5.5 · finetype 0.6.66
| Value | As TIMESTAMP |
|---|---|
| 20240115T103000 | 2024-01-15 10:30:00 |
| 20191231T235959 | 2019-12-31 23:59:59 |
- %Y
- four-digit year
- %m
- month, two digits
- %d
- day of month, two digits
- %H
- hour, 24-hour clock
- %M
- minutes
- %S
- seconds
Pattern
^\d{8}T\d{6}$| Value | Length | Shape |
|---|---|---|
| 20240115T103000 | 15 | matches |
| 20191231T235959 | 15 | matches |
| 20240115T10300 | 14 | rejected: one character short |
Background
Origin
ISO 8601 is an international standard covering the worldwide exchange and communication of date and time-related data.[1] The first edition of ISO 8601 was published as ISO 8601:1988 in June 1988.[1] ISO 8601-1:2019, issued in February 2019, is the fourth revision of the standard.[1]
ISO 8601 offers two ways to write each representation: a basic format with a minimal number of separators, and an extended format with separators added to enhance human readability.[1] ISO 8601 represents a single point in time by concatenating a complete date expression, the letter T and a time expression.[1] ISO 8601 allows either the basic or the extended format in a combined date and time, but the date and the time must use the same format.[1] The 2004 edition of ISO 8601 allowed the T to be omitted by mutual agreement, a provision that ISO 8601-1:2019 removed.[1]
Use
The iCalendar specification, RFC 5545, was published in September 2009 with B. Desruisseaux as editor.[2] RFC 5545 bases its DATE value type on the ISO 8601 complete representation, basic format for a calendar date.[2] RFC 5545 calls a DATE-TIME written without a time zone "floating", meaning it is not bound to any time zone in particular.[2] RFC 5545 marks a UTC time with a trailing letter Z, as in 19980119T070000Z.[2] A compact timestamp with no Z and no offset carries no time zone at all, so find out from the source system which clock it was written in before you compare it with anything else. (Meridian's view)
Wikipedia's article on ISO 8601 says the basic format should be avoided in plain text.[1] Python's datetime.fromisoformat parses 20111104T000523 as 4 November 2011 at 00:05:23, as one of the examples in Python's documentation.[3] Python's documentation notes that before version 3.11, datetime.fromisoformat only supported formats that could be emitted by date.isoformat() or datetime.isoformat().[3] Parse with an explicit format string such as %Y%m%dT%H%M%S rather than a guessing parser, because a run of fourteen digits around a T gives a guesser little to go on if the pattern ever drifts. (Meridian's view)
Sources
- [1]ISO 8601 - Wikipediasecondary source
- [2]RFC 5545: Internet Calendaring and Scheduling Core Object Specification (iCalendar)standard
- [3]datetime — Basic date and time types — Python 3.15.0 documentationdocumentation
Schema
https://meridian.online/schemas/datetime.timestamp.iso_8601_compact · Frictionless type datetime · %Y%m%dT%H%M%S
finetype taxonomy datetime.timestamp.iso_8601_compact -o json-schema