1

Possible Duplicate:
Calculate the number of weekdays between two dates in C#

Is there a method to know how much saturdays and sundays there are between two dates? for example: 13/01/2011 to 28/02/2011 result will be: 3 saturdays and 3 sundays

can someone help please? thank you in advance

Community
  • 1
  • 1
Tassisto
  • 9,877
  • 28
  • 100
  • 157
  • http://stackoverflow.com/questions/1820173/calculate-the-number-of-weekdays-between-two-dates-in-c - Dublicate – VMAtm Jun 01 '11 at 10:35
  • 1
    Your result is incorrect. Between the two dates you posted, there are 7 weekends. – Daniel Hilgarth Jun 01 '11 at 10:36
  • Refer to [How to calculate num of weekdays between 2 dates](http://www.eggheadcafe.com/community/aspnet/2/44982/how-to-calculate-num-of-weekdays-between-2-dates.aspx) – Akram Shahda Jun 01 '11 at 10:34

1 Answers1

1

You could traverse through days between the two dates and for each day check it against saturday and sunday. Datetime conains DayOfWeek.

FIre Panda
  • 6,537
  • 2
  • 25
  • 38