[英]Cant parse string to datetime
DateTime startDate = DateTime.ParseExact("2011-05-25 24:00:00", "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture);
for some reason parsing this string to a datetime does not want to work.出于某种原因,将此字符串解析为日期时间不想工作。 I Tried several things already but it just does not want to work.
我已经尝试了几件事,但它就是不想工作。 Most of the internet examples do it like this too.
大多数互联网示例也是这样做的。 Does someone sees what is wrong?
有人看到有什么问题吗?
thanks谢谢
"24:00:00"
is not a valid time. "24:00:00"
不是有效时间。 Should probably be "00:00:00"
.应该是
"00:00:00"
。 If you meant the second that comes after 2011-05-25 23:59:59
, that would be 2011-05-26 00:00:00
.如果您指的是
2011-05-25 23:59:59
之后的第二个,那就是2011-05-26 00:00:00
。
For more information about valid value ranges for different format specifiers, check Custom Date and Time Format Strings at MSDN.有关不同格式说明符的有效值范围的更多信息,请查看 MSDN 上的自定义日期和时间格式字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.