Using 'round-time' to figure out human readable time? - Algorand
Using ‘round-time’ to figure out human readable time?
post by traicertops on Jan 20, 2022
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?
post by fabrice on Jan 20, 2022
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.
post by traicertops on Jan 20, 2022
Thanks for the quick reply!
post by ismax on Jun 20, 2022
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'))