DateTime res;
String s;
s = "Wed, 28 Mar 2012 10:30:52 GMT";
DateTime.TryParse(s, out res);
Console.WriteLine(s + " => " + res);
s = "Fri, 15 May 2009 20:10:57 GMT";
DateTime.TryParse(s, out res);
Console.WriteLine(s + " => " + res);
输出:
Wed, 28 Mar 2012 10:30:52 GMT => 01/01/0001 00.00.00
Fri, 15 May 2009 20:10:57 GMT => 15/05/2009 22.10.57
为什么它只适用于某些日期?显然,我同时在同一台机器上运行了该代码。