代码如下:
1 ///2 /// 格式化时间字符串 3 /// 4 /// 5 ///6 private DateTime StrConvertDateToString(string strDate) 7 { 8 return (DateTime.ParseExact(strDate, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture)); //day 9 10 }11 /// 12 /// 格式化时间字符串13 /// 14 /// 15 ///16 private string StrDateConvertDateToString(string strDate)17 {18 return (DateTime.ParseExact(strDate, "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture)).ToString("yyyy-MM-dd"); //day19 20 }