convert javascript Date.now to pandas to_datetime

souparno majumder

I am trying to convert timestamp data that has been fetched with javascript Date.now() 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 Date.now() 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?

jezrael

Add parameter unit:

print (pd.to_datetime('1636460191573', unit='ms'))
2021-11-09 12:16:31.573000

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Pandas: Convert Timestamp to datetime.date

bad date recognition with pandas to_datetime

convert numeric sas date to datetime in Pandas

Convert Date.now() to Milliseconds in JavaScript

Convert string date time to pandas datetime

pandas convert date (quarters) to datetime object

convert multiple columns to datetime without the date in pandas

pandas to_datetime formatting

Convert DatetimeIndex to datetime.date in pandas?

How to convert to Pandas datetime to date to integer in pandas?

Convert column to date with mixed types. "to_datetime" not working

Pandas to_datetime with multiindex

Getting today's date using pandas to_datetime version 0.23.4

convert pandas datetime field with NAT entries to date

pandas to_datetime convert 6PM to 18

Pandas - Convert DateTime Object To Date

convert a generic date into datetime in python (pandas)

Pandas dataframe date not able to convert to datetime format

Javascript Calculate/Match Date and Datetime.now

Pandas dataframe to_datetime() is converting date incorrectly

Pandas: Convert Dataframe with days and hours using to_datetime

pandas to_datetime formats date from same column in different formats

Convert Timestamp to_datetime() and aggregate by year and month, Pandas, Python

How i do convert datetime to date pandas?

Apply pandas to_datetime function to excel date format

How to convert timestamp to pandas to_datetime?

Convert multiple date formats to datetime in pandas

Convert month name to decimal using 'to_datetime' function in Pandas

Convert pandas date column into years before now