Last active
November 19, 2020 14:34
-
-
Save makingthingswork/f81ba03d1eb523ad6af8a1eabb1634f6 to your computer and use it in GitHub Desktop.
Validate date
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
<?php | |
function valid_date(date,format='Y-m-d'){ | |
d = DateTime::createFromFormat(format, date); | |
return d && (d->format(format) == date); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment