来自:http://bbs.csdn.net/topics/380201292
如题:
求助各位大神给予支持和帮助,
C# Thu Mar 1 00:00:00 UTC+0800 2012 如何转换为2012-03-01。
string s = "Thu Mar 1 00:00:00 UTC+0800 2012";
DateTime dt = DateTime.ParseExact(s, "ddd MMM d HH:mm:ss UTCK yyyy", new CultureInfo("en-GB"));
代码——2
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
namespace TEST_DEMO_1
{
class Program
{
static void Main(string[] args)
{
string strTime = "Sun Feb 17 11:37:14 +0800 2013";
DateTime dt = new DateTime();
dt = DateTime.ParseExact(strTime, "ddd MMM d HH:mm:ss K yyyy", new CultureInfo("en-GB"));
Console.WriteLine(dt);
Console.ReadKey();
}
}
}