Click here to Skip to main content
15,905,875 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
start date=08/15/2013, end date=09/11/2013.Loop through start and end and display all the dates between.



for example


08/15/2013
08/16/2013
08/17/2013
.
.
.
.
.
.
.
.
.
09/11/2013

thanks and regards
Posted
Comments
Sergey Alexandrovich Kryukov 15-Aug-13 0:40am    
Is it an order?
—SA
CodeBlack 15-Aug-13 0:44am    
what is your question ?
ridoy 15-Aug-13 3:07am    
we don't provide ready made code for anyone.

TimeSpan can be added to DateTime objects.
Here's one way to do it using a list box:
C#
private void FillDateList()
        {
            DateTime start = new DateTime(2013, 8, 15);
            DateTime end = new DateTime(2013, 11, 9);
            TimeSpan oneday = new TimeSpan(1, 0, 0, 0);
            while (start <= end)
            {
                this.listBox1.Items.Add(start.ToShortDateString());
                start = start + oneday;
            }
        }
 
Share this answer
 
Comments
PIEBALDconsult 15-Aug-13 1:01am    
Ummm... how about .AddDays(1) ?
Sounds like homework.

Have a look at TimeRanger -- Allows foreaching across a time interval[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900