c# - Convert.ToDateTime 在 09 :59? 之后不起作用

标签 c# datetime

我有一个我编写的 C# 应用程序,但我的 Convert.ToDateTime 在 09:59 之后无法正常工作?

这是我的代码:

strDateTime = Convert.ToDateTime(arr[3].TrimStart('[').Substring(0, 11) + " " + arr[3].TrimStart('[').Substring(13, 7));

这是 arr[3] 中的内容:

[20/Feb/2014:14:21:32 +0100]

这让我发疯!

谢谢

最佳答案

string s = "[20/Feb/2014:14:21:32 +0100]";

DateTime d = DateTime.ParseExact(s, @"[dd\/MMM\/yyyy\:HH\:mm\:ss zzzz]", null);

关于c# - Convert.ToDateTime 在 09 :59? 之后不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22010363/

相关文章:

c# - Entity Framework : Model Contain A list(navigational properties) of three items of type= itself , 给出错误。 (可能是外键映射错误)

c# - 在WPF中如何防止ScrollViewer内的控件展开

具有多个表的 C# DataAdapter 和 DataSet

mysql - 如何总结没有周末的休假时间

qt - 将 QString Unix 纪元时间转换为 QString 标准时间

c# - 如何通过委托(delegate)查询方法属性?

c# - 动态 LINQ 表达式

c# - 在 DateTime 对象中存储短日期

mysql - Cakephp 时间之间的条件或者时间列不是时间

java - 检查当前时间是否在一个时隙之间