摘要:
最近需要把“20121010”转换为“2012-10-10”格式,直接用Convert.ToDateTime("20121010"),系统报错“未被识别的DateTime类型”。解决方法:一、DateTime.ParseExactstring str = "20121010";IFormatProvider ifp = new CultureInfo("zh-CN", true); DateTime dt = DateTime.ParseExact(str, "yyyyMMdd", ifp); MessageBox 阅读全文