If you come across a situation where you need to know the number of Fridays/Sundays etc for a given month you can use the following snippet.
private void NoOfSpecificDaysThisMonth() { int iDayCnt = 4; // Defaults to four days DayOfWeek dw = DayOfWeek.Wednesday; DateTime firstDay = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); int iRemainder = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month) % 7; if ((dw >= firstDay.DayOfWeek) & ((dw - firstDay.DayOfWeek) < iRemainder)) { iDayCnt = iDayCnt+1; } else if ((dw < firstDay.DayOfWeek) & ((7+ dw - firstDay.DayOfWeek) < iRemainder)) { iDayCnt = iDayCnt + 1; } MessageBox.Show(iDayCnt.ToString()); }The above gives the No Of Wednesdays for the Current month. If you want for any specific month / year you can tweak it a bit like:
DateTime firstDay = new DateTime(2012, DateTime.Now.Month, 1); int iRemainder = DateTime.DaysInMonth(2012, DateTime.Now.Month) % 7;
Other links that might be relevant:





















