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