Here is my code:
# Given an Unix timestamp in milliseconds (ts), return a human-readable date and time (hrdt)
def parseTS(ts):
hrdt = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.time(int(ts)/1000))
return str(hrdt)
I am getting this error:
TypeError: time() takes no arguments (1 given)
UPDATE:
This worked:
hrdt = datetime.datetime.fromtimestamp(int(ts)//1000)
return hrdt
The time.time(int(ts)/1000) function is wrong.
Try one of time.ctime, time.gtime() or time.localtime() functions to achieve what you want.
Python Docs (Time)