【发布时间】:2017-11-01 10:30:31
【问题描述】:
所以我有一个日期字符串与今天的短日期一起出现。 例如“1-11-2017”
//Here i convert the HttpCookie to a String
string DateView = Convert.ToString(CurrDay.Value);
//Here i convert the String to DateTime
DateTime myDate = DateTime.ParseExact(DateView, "dd-MM-yyyy", System.Globalization.CultureInfo.InvariantCulture);
运行代码后出现错误:
FormatExeption 未被用户代码处理
“System.FormatException”类型的异常发生在 mscorlib.dll 但未在用户代码中处理
附加信息:字符串未被识别为有效的日期时间。
【问题讨论】:
-
dd期望01。你想要d