Live2D 看板娘 / Demo

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;
        }

输出:

 

posted @ 2021-06-28 18:24  KysonDu  阅读(84)  评论(0编辑  收藏  举报