This forum is a read-only archive. Posting, replying and signing in are disabled.

Using 'round-time' to figure out human readable time?

traicertops

Hi, is there any way to back out a human readable time (e.g., 01-20-2022 8:21:13pm PST) from the round-time parameter from the indexer?

For example, I get “1641070304” as the value for the ‘round-time’ on a specific transaction. What would this correspond to in the real world?

✔ Solved by fabrice in post #2
edited
fabrice

The round time is a UNIX timestamp.
Most time/date libraries from most languages allow such conversions.
You can also google it and find websites that allow for such conversion.

✔ Solution
ismax

For others having same issue, here is the Python code to convert the round-time in the transaction json to a datetime object :

from datetime import datetime
ts = int(tx['round-time'])
print(datetime.utcfromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))