How to get list of all dates between two dates in asp.net

If you want to work with one by one dates between two dates then you have to get all dates between that perticuler dates in asp.net with csharp.    


  List<DateTime> li = new List<DateTime>();

        DateTime stdt = Convert.ToDateTime(txtStartDate.Text);
        DateTime endt = Convert.ToDateTime(txtEndDate.Text);
        while (stdt <= endt)
        {
            li.Add(stdt);
            stdt = stdt.AddDays(1);
        }




list li contains all dates between that two dates you can work with them.

Recent Article