static public function checkDate(string $date, string $format = 'Y-m-d'): bool
    {
        $d = DateTime::createFromFormat($format, $date);

        return $d && $d->format($format) == $date;
    }
static public function checkDate(string $date, string $format = 'Y-m-d'): bool
    {
        $d = DateTime::createFromFormat($format, $date);

        return $d && $d->format($format) == $date;
    }
static public function checkDate ( string $ date , string $ format = 'Y-m-d' ) : bool { $ d = DateTime :: createFromFormat ( $ format , $ date ) ; return $ d && $ d -> format ( $ format ) == $ date ; }
Check date validity. Return true on success or false on failure.

@param string $date
@param string $format = 'Y-m-d'

@return bool
Check date validity . Return true on success or false on failure .