Reputation: 109
I have time column in format of
Feb 21, 2019 5:50:39 PM
When I do
df['Time'] = pd.to_datetime(df['Time'])
then the time gets convert to
2019-02-21 17:50:39
But when I am using the input data with milliseconds like this- Feb 21, 2019 5:50:39:2 PM. Then it is giving the
error -> ValueError: (u'Unknown string format:', 'Feb 21, 2019 5:50:39:2 PM')
I need the same output as I have for without millisecond to have with milliseconds as well.
Expected output 2019-02-21 17:50:39:2
Upvotes: 0
Views: 50
Reputation: 46479
Try this:
t='Feb 21, 2019 5:50:39 PM'
new=pd.to_datetime(t,format='%b %d, %Y %H:%M:%S %p')
2019-02-21 05:50:39
Upvotes: 1