C# 微博日期转换
/// <summary> /// 微博日期转换(Mon Jun 28 18:00:01 +0800 2021) /// </summary> /// <param name="strDate"></param> /// <returns></returns> public static DateTime TransDate(string strDate) { System.Globalization.CultureInfo cultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture("en-US"); string format = "ddd MMM d HH:mm:ss zz00 yyyy"; DateTime dt = DateTime.ParseExact(strDate, format, cultureInfo); // 将字符串转换成日期 return dt; }
输出: