0

have got a JSON with user_uuid": "6027fd7ad748412d1c1e80e7", would like to convert it to a timestamp in millisecond.

Any help please?

Many Thanks,

1

1 Answer 1

2

It seems to have a 4-byte value representing the seconds since the Unix epoch

Indeed, that's all you need to do:

>>> uuid = "6027fd7ad748412d1c1e80e7"
>>> seconds_since_unix_epoch = int(uuid[:8], base=16)
>>> seconds_since_unix_epoch
1613233530

Then, convert to datetime:

>>> import datetime as dt
>>> dt.timedelta(seconds=seconds_since_unix_epoch) + dt.date(1970, 1, 1)
datetime.date(2021, 2, 13)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.