Skip to content

Timestamp #20

Answered by aminalaee
murtaghj asked this question in Q&A
Aug 7, 2023 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Hey @murtaghj ,
I think you can use the following snippet to get it:

import uuid_utils
b = uuid_utils.uuid7().bytes

millis = b[0] << 40 | b[1] << 32 | b[2] << 24 | b[3] << 16 | b[4] << 8 | b[5]
print(millis)

I think this is a useful method, I will add it to the public methods to make it easier with uuid_utils.uuid7().timestamp or something

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@murtaghj
Comment options

Answer selected by murtaghj
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants