CountWeekends
CountWeekends
Namespace
Summary== Counts the number of weekends between two dates. ==Example==int days=DateTime.Now.CountWeekends(DateTime.Now.AddDays(100)); ==Unit Test
public void CountWeekendsShouldBe86WhenComparing112001to512001() { var today = DateTime.Parse("1/1/2001"); var then = DateTime.Parse("5/1/2001"); var diff = today.CountWeekends(then); Assert.Equal(34, diff); }
Comments
SubSonic 3.0 implements this as an extension on System.DateTime - 2.x uses a static method on SubSonic.Sugar.Dates.