【发布时间】:2013-05-10 09:40:47
【问题描述】:
string formatString = "MMddyyyyHHmmss";
string sample = "20100611221912";
DateTime dt = DateTime.ParseExact(sample, formatString, System.Globalization.CultureInfo.InvariantCulture);
具体抛出的异常是:
System.FormatException:该字符串表示的 DateTime 在日历 System.Globalization.GregorianCalendar 中不受支持。
【问题讨论】:
-
查看 fmt 和示例:
MM == 20. -
你认为你有什么日期?它与您提供的格式匹配吗?