MeridianMERIDIAN

ISO Time with Microseconds

datetime.time.isowas datetime.time in v1

24-hour time with microsecond precision. Common in high-frequency data, scientific instruments, and log files.

Worked samples

DuckDB 1.5.5 · finetype 0.6.64

ValueAs TIME
10:30:00.12345610:30:00.123456
23:59:59.00000023:59:59
%H
hour, 24-hour clock
%M
minutes
%S
seconds
%f
fractional seconds

Shape

Length 10 to 18 characters.

Pattern
^\d{2}:\d{2}:\d{2}\.\d{1,9}$
ValueLengthShape
10:30:00.12345615matches
23:59:59.00000015matches
10.30:00.12345615rejected: separator swapped

Background

Origin

ISO 8601 is maintained by the International Organization for Standardization and was first published in 1988.[1] ISO 8601 writes a time of day in its extended format as hh:mm:ss, with colons between the hours, minutes and seconds.[1] ISO 8601 allows a decimal fraction to be added to the lowest order time element of a time representation.[1] ISO 8601 accepts either a comma or a full stop as the decimal mark between the seconds and their fraction.[1] ISO 8601:2004 preferred the comma as the decimal mark.[1] ISO 8601 sets no limit on the number of decimal places, but the number of decimal places needs to be agreed by the communicating parties.[1]

RFC 3339 grammar writes a partial time as hour, minute and second separated by colons, optionally followed by a full stop and one or more digits of fractional seconds.[2] RFC 3339 describes fractions of a second as its only rarely used option.[2]

Use

Python's datetime library defines the %f directive as the microsecond as a decimal number, zero-padded to 6 digits.[3] Python's time.isoformat writes HH:MM:SS.ffffff when the microsecond is not 0, and HH:MM:SS when it is 0.[3] Python's strptime accepts from one to six digits for %f and zero pads them on the right.[3] Python's time.fromisoformat accepts fractional seconds with any number of digits, truncating anything beyond 6.[3]

PostgreSQL's time type stores a time of day with a resolution of 1 microsecond.[4] PostgreSQL allows a precision of 0 to 6 fractional digits in the seconds field of a time value.[4] DuckDB's TIME type holds the hour, minute, second and microsecond of a day, and a separate TIME_NS type holds nanosecond precision.[5] DuckDB's documentation recommends that most applications use the TIMESTAMP types, keeping TIME for rare cases where the date part can be disregarded.[5] Before casting values with more than six fractional digits to a microsecond type, decide whether the extra precision matters to you. (Meridian's view) A time of day with no date or offset cannot be placed on a timeline by itself, so look for a companion date column and a stated time zone before treating these values as moments. (Meridian's view)

Detection notes

v1 name: datetime.time

Use it

CLI · DuckDB
$ finetype infer -i "10:30:00.123456" --mode column
→ datetime.time.iso

SELECT ft_infer('10:30:00.123456');
-- → 'datetime.time.iso'
Cast expression
strptime({col}, '%H:%M:%S.%f')::TIME
-- Format: %H:%M:%S.%f

Schema

https://meridian.online/schemas/datetime.time.iso · Frictionless type time · %H:%M:%S.%f

finetype taxonomy datetime.time.iso -o json-schema

Type Registry