How to check string's date format in PHP?

if (DateTime::createFromFormat('Y-m-d G:i:s', $myString) !== FALSE) { echo 'true'; }

Comments