Time-based UUIDs store creation timestamps in two distinct epoch systems defined by RFC 9562: Unix Epoch milliseconds for UUIDv7 and 100-nanosecond Gregorian intervals since 1582-10-15T00:00:00Z for UUIDv1 and UUIDv6.
Example 1: Decoding a UUIDv7 Primary Key
Consider a database primary key generated with UUIDv7:
01941f29-7c7b-7a3c-9f4e-2b8d5c1a0e6f
The parser reads the first 48 bits (01941f297c7b) as an unsigned big-endian millisecond integer (1735689600123), verifies nibble 13 (7, binary 0111) and the top two bits of nibble 17 (9, binary 1001 -> variant 10), and separates rand_a (12 bits) from rand_b (62 bits):
{
"canonical": "01941f29-7c7b-7a3c-9f4e-2b8d5c1a0e6f",
"version": 7,
"versionLabel": "UUIDv7 (Unix Epoch Time-Ordered)",
"variant": "RFC 9562 (10xx)",
"timestamp": {
"epochSystem": "Unix Epoch (1970-01-01T00:00:00Z)",
"unixMilliseconds": 1735689600123,
"iso8601Utc": "2025-01-01T00:00:00.123Z"
},
"fields": {
"unix_ts_ms": "0x01941f297c7b",
"ver": "0b0111 (7)",
"rand_a": "0xa3c (12 bits)",
"var": "0b10",
"rand_b": "0x1f4e2b8d5c1a0e6f (62 bits)"
}
}
Example 2: Decoding UUIDv1 vs Reordered UUIDv6
Both identifiers below encode the exact same Gregorian timestamp (0x1efc7d357fd0000 = 139549824000000000 ticks of 100 ns), clock sequence, and node ID, differing only in how the 60 timestamp bits are arranged across octets 0 through 7:
UUIDv1: 57fd0000-c7d3-11ef-aa1b-3d8f4a91c20e
UUIDv6: 1efc7d35-7fd0-6000-aa1b-3d8f4a91c20e
Reassembling time_hi (1ef), time_mid (c7d3), and time_low (57fd0000) from UUIDv1—or concatenating time_high (1efc7d35), time_mid (7fd0), and time_low (000) from UUIDv6—and subtracting the Gregorian-to-Unix offset (122192928000000000 ticks) yields the decoded field report:
{
"canonical": "57fd0000-c7d3-11ef-aa1b-3d8f4a91c20e",
"version": 1,
"variant": "RFC 9562 (10xx)",
"timestamp": {
"gregorianTicks100ns": "139549824000000000",
"unixMilliseconds": 1735689600000,
"subMillisecondNanoseconds": 0,
"iso8601Utc": "2025-01-01T00:00:00.000Z"
},
"clockSequence": {
"hex": "0x2a1b",
"decimal": 10779
},
"node": {
"formatted": "3d:8f:4a:91:c2:0e",
"multicastBit": 1,
"nodeType": "Pseudorandom multicast node (RFC 9562 Section 6.10)"
}
}