5 cents hint – c# looping between date range

By | 3. May 2017

If you need looping between date range then there are many ways to solve this task.

Here is one simple code snippet

DateTime startDate = new DateTime(2017, 1, 1);
DateTime endDate = DateTime.Today;

// looping between date range    
while (startDate < endDate)
{
 // ... to the "thing"
 startDate = startDate.AddDays(1);
}

Mission completed.

Leave a Reply