How to loop between two dates

后端 未结 5 1349
面向向阳花
面向向阳花 2021-02-04 02:12

I have a calendar which passes selected dates as strings into a method. Inside this method, I want to generate a list of all the dates starting from the selected start date and

5条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 02:41

    for( DateTime i = start; i <= end; i = i.AddDays( 1 ) )
    {
        Console.WriteLine(i.ToShortDateString());
    }
    

提交回复
热议问题