Hello Friends,
I wrote this Method to find the number of occurrence of a particular day within a date range.
Code:
private int FindDayInDates(string dayToFind, DateTime lowerDate, DateTime upperDate)
{
int dayCount = 0;
while (lowerDate <= upperDate)
{
if (dayToFind.Equals(lowerDate.DayOfWeek.ToString()))
dayCount++;
lowerDate = lowerDate.AddDays(1);
}
return dayCount
}