I think you should be able to use `DateTime.TryParse()` to greatly simplify this.