php validate date format yyyy mm dd

Solutions on MaxInterview for php validate date format yyyy mm dd by the best coders in the world

showing results for - "php validate date format yyyy mm dd"
Luca
19 Mar 2018
1$date="2012-09-12";
2
3if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/",$date)) {
4    return true;
5} else {
6    return false;
7}