text: public static DateTime ParseDate(String strVal){String[] parts = strVal.Split("-/".ToCharArray());if (parts.Length != 3){throw new EvaluationException(ErrorEval.VALUE_INVALID);}String part2 = parts[2];int spacePos = part2.IndexOf(' ');if (spacePos > 0){part2 = part2.Substring(0, spacePos);}int f0;int f1;int f2;try{f0 = int.Parse(parts[0]);f1 = int.Parse(parts[1]);f2 = int.Parse(part2);}catch (FormatException){throw new EvaluationException(ErrorEval.VALUE_INVALID);}if (f0 < 0 || f1 < 0 || f2 < 0 || (f0 > 12 && f1 > 12 && f2 > 12)){throw new EvaluationException(ErrorEval.VALUE_INVALID);}if (f0 >= 1900 && f0 < 9999){return MakeDate(f0, f1, f2);}if (false){return MakeDate(f2, f0, f1);}throw new RuntimeException("Unable to determine date format for text '" + strVal + "'");}