1

I have this date-time in UTC/GMT

'2016-02-10T15:10:00.000Z'

I want to convert it into unix timestamp. Here it is:

from datetime import timezone, datetime
# ....

dt1 = '2016-02-10T15:10:00.000Z'
dt2 = dt1.replace('T', ' ').replace('.000Z', '')
unix_ts1 = datetime.fromisoformat(dt2).timestamp()

===>

1455124200.0

However, that's incorrect, and the correct result should've been 1455117000000 (ms) or 1455117000 (sec)

What's the matter?

Kum
  • 45
  • 1
  • 7

0 Answers0