-1

I want to get a Date from a UNIX Timestamp in Python with the following code:

datetime.fromtimestamp(timestamp)

with the timestamp being 1605532620337.2188, but I am getting this error:

OSError: [Errno 22] Invalid argument
tzimom
  • 355
  • 2
  • 11

1 Answers1

0

Try this:

from datetime import datetime
print(datetime.fromtimestamp(1605532620337.2188 // 1000))

Output:

2020-11-16 14:17:00
baduker
  • 19,152
  • 9
  • 33
  • 56