我有一个显示日期和时间如下格式的字符串:转换日期和时间字符串的DateTime在C#
周四年1月3 15点04分29秒2013
我将如何将它转换为一个DateTime ?我曾尝试过:
string strDateStarted = "Thu Jan 03 15:04:29 2013"
DateTime datDateStarted = Convert.ToDateTime(strDateStarted);
但这不起作用。在我的程序中,这个值是从日志文件读入的,所以我无法改变文本字符串的格式。
类似于'DateTime.ParseExact(str,“ddd MMM dd HH:mm:ss yyyy”,null)' – 2013-03-22 12:55:28
[C#Convert date to datetime](https://www.google.se/search?q = C%23 +转换+日期+到+日期时间) – Default 2013-03-22 12:56:01