Created
April 10, 2018 10:43
-
-
Save otkrsk/6a2d1639421146b9592ce1b2fba2dda4 to your computer and use it in GitHub Desktop.
Check if a given string is in a valid date format
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
$myString = "2010-10-10 00:00:00"; | |
if (DateTime::createFromFormat('Y-m-d G:i:s', $myString) !== FALSE) { | |
// it's a date | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment