Last active
June 28, 2022 05:41
-
-
Save mjordan/5bf8e71b3d963a44cd2e64db01ae7086 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def validate_date(date): | |
""" | |
Validates a yyyy-mm-dd date string. | |
- **date**: the date string to validate. | |
""" | |
try: | |
is_valid = time.strptime(date, '%Y-%m-%d') | |
except ValueError: | |
return False | |
# If there's no ValueError, date validates. | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment