c# - DateTimePicker Loop Through Weks -


i have 2 datetimepickers: startdate , enddate

i need how loop through weeks between 2 dates. example weeks between 02/01/2013 - 02/01/2014.

i want loop start @ 02/01/2013 , increment 7 days on each iteration until gets end date. i've been trying think of way achieve can't find solution.

is possible?

solved:

for (datetime = datestart.value; <= dateend.value; = i.adddays(7)) {     // on each iteration } 

will update answer in 8 hours. won't let me answer own question.

here 1 way approach this:

        var startdate = new datetime(2013, 2, 1);         var enddate = new datetime(2014, 2, 1);          var totaldays = enddate.subtract(startdate).totaldays;          // determine total number of weeks.         var totalweeks = totaldays / 7;          // initialize current date start date         var currdate = startdate;          // process each of weeks         (var week = 0; week < totalweeks; week++)         {             //              // next date             currdate = currdate.adddays(7);         } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -