G
Guest
Does anyone know why you cannot add days/months/years to a DateTime variable in a for next loop?
ArrayList ary = new ArrayList();
for (DateTime sd = start_date;sd <= end_date;sd.AddDays(1))
{
string moYear = sd.Month.ToString().PadLeft(2,'0') + sd.Year.ToString();
if (!ary.Contains(moYear))
ary.Add(moYear);
}
ArrayList ary = new ArrayList();
for (DateTime sd = start_date;sd <= end_date;sd.AddDays(1))
{
string moYear = sd.Month.ToString().PadLeft(2,'0') + sd.Year.ToString();
if (!ary.Contains(moYear))
ary.Add(moYear);
}