DateInterval ClassNoda Time

[This is preliminary documentation and is subject to change.]

An interval between two dates.
Inheritance Hierarchy

OnlineSystem Object
  NodaTime DateInterval

Namespace: NodaTime
Assembly: NodaTime (in NodaTime.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax

public sealed class DateInterval : IEquatable<DateInterval>
Remarks

The two dates must be in the same calendar, and the end date must not be earlier than the start date.

By default, the end date is deemed to be part of the range, as this matches many real life uses of date ranges. For example, if someone says "I'm going to be on holiday from Monday to Friday," they usually mean that Friday is part of their holiday. This can be configured via a constructor parameter, as occasionally an exclusive end date can be useful. For example, to create an interval covering a whole month, you can simply provide the first day of the month as the start and the first day of the next month as the exclusive end.

Values can be compared for equality, but note that inclusive intervals and exclusive intervals are always considered to differ, even if they cover the same range of dates.

Version Information

Available since: 2.0.0
Supported in the PCL? Yes
Thread Safety

This type is immutable reference type. See the thread safety section of the user guide for more information.
See Also