convert javascript to pandas to_datetime


I am trying to convert timestamp data that has been fetched with javascript and get the date and time into pandas.DataFrame.
I am using pandas.to_datetime to convert the timestamp.

However According to the doc The static method returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.

so, converting the timestamp 1636460191573 using pd.to_datetime('1636460191573') give Timestamp('1970-01-01 00:27:16.460191573')

How do I get the date and time from the timestamp in dd/mm/yyyy and hh:mm:sec format?


Add parameter unit:

timestamp = pd.to_datetime('1636789077923', unit='ms').ceil(freq='s')



Answered By – jezrael

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published