Aqueduct.Extensions.Dates.CountWeekdays C# (CSharp) Method

CountWeekdays() public static method

Counts the number of weekdays between two dates.
public static CountWeekdays ( this startTime, System.DateTime endTime ) : int
startTime this The start time.
endTime System.DateTime The end time.
return int
        public static int CountWeekdays(this DateTime startTime, DateTime endTime)
        {
            TimeSpan ts = endTime - startTime;
            Console.WriteLine(ts.Days);
            int cnt = 0;
            for (int i = 0; i < ts.Days; i++)
            {
                DateTime dt = startTime.AddDays(i);
                if (IsWeekDay(dt))
                    cnt++;
            }
            return cnt;
        }