I trying to find a simple way to solve this.
I have a Initial Date, and a Final Date.
And I want to generate a List<Datetime> with each of the dates in a given period.
List<Datetime>
Example : Initial Date is "2013/12/01" and Final Date is "2013/12/05".
And I want to automatically populate a list with
"2013/12/01" "2013/12/02" "2013/12/03" "2013/12/04" "2013/12/05"
What would you suggest me?
Thanks
var startDate = new DateTime(2013, 12, 1); var endDate = new DateTime(2013, 12, 5); var dates = Enumerable.Range(0, (int)(endDate - startDate).TotalDays + 1) .Select(x => startDate.AddDays(x)) .ToList();
1.4m articles
1.4m replys
5 comments
57.0k users