# convert string to date from datetime import datetime date_string = "2022-03-10 10:10:10" print (datetime.fromisoformat(date_string)) 2022-03-10 10:10:10