def convert_date(date: str) -> str:
date = date[::-1]
new_date = date.replace("/","-")
from datetime import datetime
try:
datetime.strptime(new_date,"%d-%m-%Y")
return new_date
except ValueError:
return "Error.Invalid date."
Created at: 2023/10/24 04:22; Updated at: 2023/10/24 05:51
The question is resolved.