I am having a variable which holds date as string like March 21, 2015,so I need to check whether it is a valid in php.I tries to check using
$date = 'July 20 2018';
echo date('d/m/Y', strtotime($date))
;
But it showing error and also tried
if (DateTime::createFromFormat('Y-m-d G:i:s', $myString) !== FALSE) { //valid date }
Getting error 2nd parameter must be string. Please anybody can help me !