Skip to main content
Community Create a UUIDv7 object from a timestamp and random bits. ts is converted to a UNIX timestamp split into millisecond and sub-millisecond parts. UUIDv7 microseconds

Samples

SELECT to_uuidv7(ts)
FROM generate_series('2025-01-01:00:00:00'::timestamptz, '2025-01-01:00:00:03'::timestamptz, '1 microsecond'::interval) ts;

Arguments

NameTypeDefaultRequiredDescription
tsTIMESTAMPTZ-The timestamp used to return a UUIDv7 object