Quantcast
Channel: Convert string "Jun 1 2005 1:33PM" into datetime - Stack Overflow
Viewing all articles
Browse latest Browse all 55

Answer by Hazrat ali for Converting string into datetime

$
0
0

It gets complicated when you do not have a specific pattern in the whole list but if you have a pattern and you want to convert the raw string into datetime object. then the following code might help although other friends have also mentioned it.import pandas as pd

dates = ['2021-10-15', '2022-10-16', '2024-10-16']dates_1 = [d.date() for d in pd.to_datetime(dates)]for date in dates_1:    print(date)

To make sure things works right. you might need to create a parser.


Viewing all articles
Browse latest Browse all 55

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>