0
Using the command below:
pd.to_datetime(1490195805, unit='s')
The return is:
Timestamp('2017-03-22 15:16:45')
How do I extract only the time: 15:16:45?
0
Using the command below:
pd.to_datetime(1490195805, unit='s')
The return is:
Timestamp('2017-03-22 15:16:45')
How do I extract only the time: 15:16:45?
2
You can do with the time function:
import pandas as pd
a = pd.to_datetime(1490195805, unit='s')
str(a.time())
Exit:
'15:16:45'
Browser other questions tagged python pandas datetime timestamp
You are not signed in. Login or sign up in order to post.
Hi, use the
datetime
...datetime.strftime(pd.to_datetime(1490195805, unit='s'), format="%H:%M:%S")
– Paulo Marques
This answers your question? Convert timestamp to date/time
– hkotsubo
If you do not need to use pandas, the question suggested above should already suit your case (just adapt what you have there - in particular this answer - to show time fields only)
– hkotsubo