Created
December 17, 2019 15:44
-
-
Save MartinTale/636c226d0fac5366daac87f720bac97c to your computer and use it in GitHub Desktop.
PHP functions that validates that the given string is a 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 | |
if (! function_exists('isDate')) | |
{ | |
function isDate($string) | |
{ | |
if (DateTime::createFromFormat('Y-m-d', trim($string)) !== FALSE) { | |
return true; | |
} | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment