[code=python] ¶
def checkdate(m, d, y): ¶
import
datetime ¶
try: ¶
m, d, y = map(int, (m, d, y)) ¶
datetime.date(y, m, d) ¶
return True ¶
except ValueError: ¶
return False ¶
[/code] ¶

Using: ¶

checkdate(12, 10, 2000) ¶
# True ¶

checkdate("01", "01", "2000") ¶
# True ¶

checkdate(13, 10, 2000) ¶
# False ¶

checkdate("12", "32", "2000") ¶
# False