【发布时间】:2009-08-06 10:40:43
【问题描述】:
我正在尝试使用自定义验证器验证输入到文本框中的日期:
string CombinedDate = String.Format("{0}-{1}-{2}", txtDay.Text, txtMonth.Text, txtYear.Text);
if (DateTime.TryParseExact(CombinedDate, "dd-MM-YYYY", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None, out date))
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
但它在 21-02-2005 失败了,这是为什么呢? 以及我该如何解决它
【问题讨论】:
-
还有哪些其他日期失败?