日期:2014-05-18 浏览次数:21234 次
String a1 = "20100401"; String a2 = "20120410"; String s = ""; DateTime d = DateTime.ParseExact(a1, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); while (!d.ToString("yyyyMMdd").Equals(a2)) { d = d.AddDays(1); s+= d.ToString("yyyyMMdd") + "\r\n"; } MessageBox.Show(s);
------解决方案--------------------
string s="20100401"; srting str=String.Format("{0}-{1}-{2}",s.SubString(0,4),s.SubString(4,2),s.SubString(6,2)); DateTime dt=DateTime.Parse(str); dt.AddDays(1); string ret=dt.ToString("yyyyMMdd");//20100402
------解决方案--------------------