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.