To convert between datetime, Timestamp and datetime64 in Python Pandas, we can use the Timestamp
function.
For instance, we write
pd.Timestamp(numpy.datetime64('2012-05-01T01:00:00.000000'))
to call Timestamp
on a NumPy datetime64
value.
We can use to_datetime
to convert a date time string to a Pandas date time value.
For instance, we write
pd.to_datetime('2022-05-01T01:00:00.000000+0100')
to call pd.to_datetime
with a date time string to return a Python datetime
value from it.