同步数据库的时候,需要提供一个日期字符串 如20080906
我数据库记录了上次同步日期 20080815假如我下一次同步,需要从20080815 同步到今天,我如何得到一个数组里面包含从最后一个同步到今天所有日期的字符串?
比如{20080815,20080816,20080817....20080906,20080907} ?
我数据库记录了上次同步日期 20080815假如我下一次同步,需要从20080815 同步到今天,我如何得到一个数组里面包含从最后一个同步到今天所有日期的字符串?
比如{20080815,20080816,20080817....20080906,20080907} ?
DateTime start = DateTime.ParseExact("20080815", "yyyyMMdd", null);
DateTime end = DateTime.ParseExact("20080907", "yyyyMMdd", null);
List<string> list = new List<string>();
while (start <= end)
{
list.Add(start.ToString("yyyyMMdd"));
start = start.AddDays(1);
}
foreach (string s in list)
{
richTextBox2.Text += s + "\n";
}