search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

HELP ! I use Sheduler . I want count all sunday in beween tow days

Asked by Help me!
7 years ago.

EX day format : MM/DD/YYYY
start day : "4 - 1 - 2013 "
End day : " 5 - 2 - 2013 "

I WANT COUNT ALL SUNDAY IN TO 4-1-2013 FROM 5 /2 / 2013

Answer posted by Dan Letecky [DayPilot]
7 years ago.
DateTime start = Convert.ToDateTime("2013-04-01");
DateTime end = Convert.ToDateTime("2013-05-02");
int count = 0;

for(DateTime d = start.Date; d < end.Date; d = d.AddDays(1)) {
  if (d.DayOfWeek == DaysOfWeek.Sunday) {
    count += 1;
  }
}
Comment posted by Anonymous
7 years ago.

thank very much

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.