Closed k-bx closed 1 year ago
Would be nice to have a simple function that could extract the timestamp part of the uuidv7 value.
For now, I've found this ugly hack:
SELECT to_timestamp(('x' || ltrim((decode(replace(uuid_generate_v7()::text, '-', ''), 'hex'))::text, '\x'))::bit(48)::bigint / 1000);
Check out version 1.1.0, I added the uuid_v7_to_timestamptz function.
uuid_v7_to_timestamptz
Perfect, thank you!
Would be nice to have a simple function that could extract the timestamp part of the uuidv7 value.
For now, I've found this ugly hack: