src/Functions/ExtendedOperations/ValidityFunctions.php
public function isValidDate($datetime, string $format = 'Y-m-d H:i:s'): bool
    {
        $dateType = DateTime::createFromFormat($format, $datetime);
        return (bool) ($dateType && $dateType->format($format) === $datetime);
    }
public function isValidDate($datetime, string $format = 'Y-m-d H:i:s'): bool
    {
        $dateType = DateTime::createFromFormat($format, $datetime);
        return (bool) ($dateType && $dateType->format($format) === $datetime);
    }
public function isValidDate ( $ datetime , string $ format = 'Y-m-d H:i:s' ) : bool { $ dateType = DateTime :: createFromFormat ( $ format , $ datetime ) ; return ( bool ) ( $ dateType && $ dateType -> format ( $ format ) === $ datetime ) ; }
Check the format and the validity of a date.

@param string $datetime The date or timestamp
@param string $format   The format

@return bool

@api
Check the format and the validity of a date .