天天看點

新浪微網誌時間處理

在寫一個用戶端,發現一個字段不好處理,created_at,不知道為什麼用這個格式,先處理成自己能接受的格式吧。 [csharp] string str = "Fri Jul 09 00:00:00 +0800 2010"; System.Globalization.CultureInfo cultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); string format = "ddd MMM d HH:mm:ss zz00 yyyy"; DateTime dt = DateTime.ParseExact(str, format, cultureInfo); // 将字元串轉換成日期 MessageBox.Show(dt.ToLocalTime().ToString()); [/csharp]

轉載于:https://www.cnblogs.com/Robyte/archive/2011/03/10/2591292.html