Search code examples
pythonpandasstrftime

Identifying datetime format for extracting date in pandas


I have a time data in the following format. I am trying to extract date only from it. But I am confused what format is that.

2019-04-30 16:24:26.7913438 -04:00

I tried '%d-%b-%y %H.%M.%S.%f', but didn't work.

Thank you!


Solution

  • I found a solution. I just had to put utc=True, and it worked magic.

    pd.to_datetime(a['AdmissionD'], utc=True).dt.date
    

    Thank you!