I'm currently coding an account signup on python and I need the user to enter their date of birth in the format DD/MM/YYYY.
How would I be able to check in the code if the input is valid or not?
dob=input("Enter your date of birth in the format DD/MM/YYYY")
import datetime
try:
date_of_birth = datetime.datetime.strptime(dob, "%d/%m/%Y")
except:
print("Incorrect date!")