I\'m receiving a date string from an API, and it is formatted as yyyy-mm-dd.
yyyy-mm-dd
I am currently using a regex to validate the string format, which works ok,
Accordling with cl-sah's answer, but this sound better, shorter...
function checkmydate($date) { $tempDate = explode('-', $date); return checkdate($tempDate[1], $tempDate[2], $tempDate[0]); }
Test
checkmydate('2015-12-01');//true checkmydate('2015-14-04');//false