Quick answer
Take the first 12 characters of the UUID (ignoring hyphens) and read them as a hexadecimal number. That number is the creation time in milliseconds since 1 January 1970, UTC.
Try it with your own UUID
Where the time lives
A UUID v7 is 128 bits. The first 48 bits, which are the first 12 hex characters, hold the time. The next digit is always 7, the version. The rest is random, apart from two bits that mark the standard layout.
- Timestamp, 48 bits
- Random, 74 bits
- Version, always 7
- Variant, 8, 9, a or b
Step by step
Using the example above:
- Remove the hyphens and keep the first 12 characters
01a1681885c0 - Convert from hexadecimal to a normal number
1792747800000 - Read it as milliseconds since 1 Jan 1970, UTC
2026-10-23 09:30:00.000 UTC
Read it in code
JavaScript
const hex = id.replace(/-/g, '').slice(0, 12);
const created = new Date(parseInt(hex, 16));
// 2026-10-23T09:30:00.000Z
Python
from datetime import datetime, timezone
ms = int(id.replace("-", "")[:12], 16)
created = datetime.fromtimestamp(ms / 1000, tz=timezone.utc)
# 2026-10-23 09:30:00+00:00
In PostgreSQL
PostgreSQL 18 can make v7 IDs with uuidv7() and read the time back with uuid_extract_timestamp(). On older versions, parse the hex yourself:
SELECT to_timestamp(
('x0000' || substr(replace(id::text, '-', ''), 1, 12))
::bit(64)::bigint / 1000.0
) AS created
FROM users;
Good to know
Precision is one millisecond
IDs made in the same millisecond only sort among themselves if the library adds a counter.
The time comes from the machine's clock
If that clock was wrong, the time in the ID is wrong too.
Anyone can read it
Anyone holding the ID can see when it was created. Use UUID v4 where that should stay private.

