标签:
一、//格式化为DateTime nowdate = nowdate.Substring(0, 4) + "-" + nowdate.Substring(4, 2) + "-" + nowdate.Substring(6, 2) + " " + nowdate.Substring(8, 2) + ":" + nowdate.Substring(10, 2) + ":" + nowdate.Substring(12, 2); DateTime DTnowdate = Convert.ToDateTime(nowdate); 二、 把字符串20160620093031转换成2016/6/20 9:30:31 string TarStr = "yyyyMMddHHmmss"; //注意这里用到HH IFormatProvider format = new System.Globalization.CultureInfo("zh-CN"); DateTime MyDate = DateTime.ParseExact(datetime, TarStr, format);
标签:
原文地址:http://www.cnblogs.com/twinklemaple/p/5944539.html