public function validate_iso_date($a)
    {
        $date = explode('-', $a);

        $msg = 'Must be date in format: YYYY-MMM-DD';

        if (count($date) != 3) {
            return $this->fail($msg);
        }

        if (strlen($date[0]) !== 4 || strlen($date[1]) !== 2 || strlen($date[2]) !== 2) {
            return $this->fail($msg);
        }

        if (!@checkdate($date[1], $date[2], $date[0])) {
            return $this->fail($msg);
        }
    }
public function validate_iso_date($a)
    {
        $date = explode('-', $a);

        $msg = 'Must be date in format: YYYY-MMM-DD';

        if (count($date) != 3) {
            return $this->fail($msg);
        }

        if (strlen($date[0]) !== 4 || strlen($date[1]) !== 2 || strlen($date[2]) !== 2) {
            return $this->fail($msg);
        }

        if (!@checkdate($date[1], $date[2], $date[0])) {
            return $this->fail($msg);
        }
    }
public function validate_iso_date ( $ a ) { $ date = explode ( '-' , $ a ) ; $ msg = 'Must be date in format: YYYY-MMM-DD' ; if ( count ( $ date ) != 3 ) { return $ this -> fail ( $ msg ) ; } if ( strlen ( $ date [ 0 ] ) !== 4 || strlen ( $ date [ 1 ] ) !== 2 || strlen ( $ date [ 2 ] ) !== 2 ) { return $ this -> fail ( $ msg ) ; } if ( ! @ checkdate ( $ date [ 1 ] , $ date [ 2 ] , $ date [ 0 ] ) ) { return $ this -> fail ( $ msg ) ; } }
Validate for ISO date in format YYYY-MM-DD.

Also checks for valid month and day values
Validate for ISO date in format YYYY - MM - DD .