Diff
Diff
Namespace
Summary== Diffs two dates, returning a TimeSpan ==Example==TimeSpan time=DateTime.Diff(DateTime.Now, DateTime.AddDays(3)); ==Unit Test
public void DiffShouldReturn3DayTimespanForDateTimeNowAndAddDays3() { var today = DateTime.Now; var then = DateTime.Now.AddDays(3); var diff = today.Diff(then); Assert.Equal(-3, diff.Days); }
Comments
SubSonic 3.0 implements this as an extension on System.DateTime - 2.x uses a static method on SubSonic.Sugar.Dates.