A
A
Alexander Shendrik2020-05-20 19:40:18
Python
Alexander Shendrik, 2020-05-20 19:40:18

Why does datetime.fromtimestamp give wrong result?

Faced a strange problem

datetime.fromtimestamp(1535630541000).strftime("%d.%m.%Y")

It gives out 03/12/50632, although the correct value is 08/30/2018
I checked the time here:
https://www.epochconverter.com
What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-05-20
@TheSuperD20

Python and JS have a different concept of timestamps

datetime.fromtimestamp(1535630541000 / 1000).strftime("%d.%m.%Y")
'30.08.2018'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question