CountWeekdays

edit

CountWeekdays

Namespace

Summary== Counts the number of weekdays between two dates. ==Example==int weekdays=DateTime.Now.CountWeekdays(DateTime.Now.AddDays(100)); ==Unit Test

public void CountWeekdaysShouldBe86WhenComparing112001to512001() { var today = DateTime.Parse("1/1/2001"); var then = DateTime.Parse("5/1/2001"); var diff = today.CountWeekdays(then); Assert.Equal(86, diff); }

Comments

SubSonic 3.0 implements this as an extension on System.DateTime - 2.x uses a static method on SubSonic.Sugar.Dates.