MetaDatetime::IsValid PHP Method

IsValid() public static method

public static IsValid ( $p_value )
    public static function IsValid($p_value)
    {
        $p_value = trim($p_value);
        // now() is an value which have to be computed
        if (strtolower($p_value) == 'now()') {
            return true;
        }
        $datetimeParts = preg_split('/[\\s]+/', $p_value);
        $date = $datetimeParts[0];
        $time = isset($datetimeParts[1]) ? $datetimeParts[1] : '00:00:00';
        if (!MetaDate::IsValid($date)) {
            return false;
        }
        if (!MetaTime::IsValid($time)) {
            return false;
        }
        return true;
    }