public static function isDateTime($value)
    {
        if ($value instanceof \DateTime) {
            return true;
        }

        $date   = new \DateTime($value);
        $errors = $date->getLastErrors();

        return (0 == $errors['warning_count'] && 0 == $errors['error_count']);
    }
public static function isDateTime($value)
    {
        if ($value instanceof \DateTime) {
            return true;
        }

        $date   = new \DateTime($value);
        $errors = $date->getLastErrors();

        return (0 == $errors['warning_count'] && 0 == $errors['error_count']);
    }
public static function isDateTime ( $ value ) { if ( $ value instanceof \ DateTime ) { return true ; } $ date = new \ DateTime ( $ value ) ; $ errors = $ date -> getLastErrors ( ) ; return ( 0 == $ errors [ 'warning_count' ] && 0 == $ errors [ 'error_count' ] ) ; }
Checks if a value is a a valid datetime format.

@param string|\DateTime $value

@return bool
Checks if a value is a a valid datetime format .