首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

"Thu Apr 19 14:56:45 +0800 2012"这样格式的字符串如何转成DateTime类型

2012-04-21 
Thu Apr 19 14:56:45 +0800 2012这样格式的字符串怎么转成DateTime类型Thu Apr 19 14:56:45 +0800 2012

"Thu Apr 19 14:56:45 +0800 2012"这样格式的字符串怎么转成DateTime类型
"Thu Apr 19 14:56:45 +0800 2012"这样格式的字符串怎么转成DateTime类型?

谢谢

[解决办法]
string xx = "Thu Jul 28 10:00:00 UTC+0800 2005";
string[] cx = xx.Split(' ');
System.Globalization.DateTimeFormatInfo g = new System.Globalization.DateTimeFormatInfo();
g.LongDatePattern = "dd MMMM yyyy";
DateTime DT = DateTime.Parse(string.Format("{0} {1} {2} {3}", cx[2], cx[1], cx[5], cx[3]), g);
MessageBox.Show(DT.ToString());


结贴吧

热点排行