What Information Can Be Decoded?
The information extractable from a UUID depends on its version:
| Version | Timestamp | Other Extractable Info |
|---|---|---|
| UUID v1 | Yes (Gregorian) | Clock sequence, Node ID (MAC address) |
| UUID v2 | Yes (Gregorian) | Local domain, Local ID |
| UUID v3 | No | None (MD5 hash only) |
| UUID v4 | No | None (random only) |
| UUID v5 | No | None (SHA-1 hash only) |
| UUID v6 | Yes (Gregorian, reordered) | Clock sequence, Node ID |
| UUID v7 | Yes (Unix milliseconds) | Random bits |
| UUID v8 | Vendor-specific | Custom (vendor-defined) |
Understanding UUID Timestamps
UUID v1/v6 Timestamp
- Epoch: October 15, 1582 00:00:00
- Resolution: 100 nanoseconds
- Bits: 60 bits
- Range: 1582 to ~5236 AD
The Gregorian calendar reform date was chosen as epoch.
UUID v7 Timestamp
- Epoch: January 1, 1970 00:00:00 UTC
- Resolution: Milliseconds
- Bits: 48 bits
- Range: 1970 to ~10889 AD
Standard Unix epoch, familiar to most developers.
Extract Timestamp in Code
import uuid
from datetime import datetime, timedelta
# Parse UUID v1
my_uuid = uuid.UUID('6ba7b810-9dad-11d1-80b4-00c04fd430c8')
# Check version
print(f"Version: {my_uuid.version}") # 1
# Extract timestamp (100-ns intervals since Oct 15, 1582)
uuid_time = my_uuid.time
# Convert to datetime
epoch = datetime(1582, 10, 15)
timestamp = epoch + timedelta(microseconds=uuid_time // 10)
print(f"Created: {timestamp}") # 1998-02-04 22:13:53.151182
function extractV7Timestamp(uuid) {
// Remove hyphens and take first 12 hex chars (48 bits)
const hex = uuid.replace(/-/g, '').substring(0, 12);
const timestamp = parseInt(hex, 16);
return new Date(timestamp);
}
const uuid = '018f4360-7a70-7c5e-bcd5-1a2b3c4d5e6f';
const created = extractV7Timestamp(uuid);
console.log(created.toISOString()); // 2024-05-20T15:30:45.123Z
import java.util.UUID;
import java.time.Instant;
UUID uuid = UUID.fromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8");
// Check if v1
if (uuid.version() == 1) {
// Get timestamp (100-ns intervals since 1582)
long timestamp = uuid.timestamp();
// Convert to Unix time (ms since 1970)
long unixMs = (timestamp - 0x01b21dd213814000L) / 10000;
Instant instant = Instant.ofEpochMilli(unixMs);
System.out.println(instant); // 1998-02-04T22:13:53.151Z
}
Related Tools
Frequently Asked Questions
Can I decode any UUID to get a timestamp?
No. Only UUID versions 1, 2, 6, and 7 contain timestamps. UUID v3, v4, and v5 are either random or hash-based and don't contain recoverable time information.
Is the decoded timestamp the creation time?
Usually yes, but not guaranteed. The timestamp represents when the UUID was generated, which may differ from when the associated record was created. Also, system clocks can be incorrect.
Can I get the MAC address from UUID v1?
The last 48 bits of UUID v1 contain the node ID, which is traditionally the MAC address. However, many implementations use a random node ID for privacy. Our decoder shows this field but notes it may be random.