javascript time stamp to python date
Posted: Wed Nov 07, 2018 3:27 am
I am getting a timestamp in miliseconds via json from javascript nodejs, I cannot change this format.
When I try and convert this to a python date, it is 30 years in the future:
However this is not as easy as just deducting 60 x 60 x 24 x 365 x 30 as there are leap years to consider.
Is there a simple way of converting a numeric javascript time in miliseconds to python date ?
When I try and convert this to a python date, it is 30 years in the future:
Code: Select all
>>> import utime
>>> jsmsec = 1541559855359
>>> jssecs = int(jsmsec/1000)
>>> utime.localtime(jssecs)
(2048, 11, 6, 3, 3, 28, 4, 311)
Is there a simple way of converting a numeric javascript time in miliseconds to python date ?