I am trying to convert a unix timestamp into a date like DD/MM/YYYY HH:MM:SS. For some reason I can not make it to work. Can you please have a look what I am doing wrong, I just started with Python 3.8.8
import requests, json
import datetime as dt
r = requests.get('https://api1.binance.com/api/v3/ticker/24hr')
jm = json.loads(r.text)
for n in range(len(jm)):
x=(jm[n] ['closeTime'])
# printing unix timestamp
print (x)
# trying to get the date time
time_val = dt.datetime.fromtimestamp(x)
print(time_val)
Appreciate your time and help. thx.