Date Time Interval
An interval between two date-times, assumed to be at the same offset from UTC.
DateTime.MIN and DateTime.MAX are used as sentinels to indicate an unbounded (ie. infinite) start or end.
Constructors
Types
Functions
Checks if this interval's end is bounded, meaning it has a finite value.
Checks if this interval's start is bounded, meaning it has a finite value.
Checks if this interval's end is unbounded. In ISO-8601 terminology, this is an "open" end.
Checks if this interval's start is unbounded. In ISO-8601 terminology, this is an "open" start.
Checks if both the start and end of this interval are unbounded, meaning this is an infinite time period in both directions.
Properties
Extensions
Combines this DateTimeInterval with a TimeZone to create a ZonedDateTimeInterval where both endpoints are in zone.
The number of whole centuries between the start and end of this interval.
The number of whole days between the start and end of this interval.
The number of whole decades between the start and end of this interval.
The number of whole hours between the start and end of this interval.
The number of whole microseconds between the start and end of this interval.
The number of whole milliseconds between the start and end of this interval.
The number of whole minutes between the start and end of this interval.
The number of whole months between the start and end of this interval.
The number of nanoseconds between the start and end of this interval.
The number of whole seconds between the start and end of this interval.
The number of whole weeks between the start and end of this interval.
The number of whole years between the start and end of this interval.
Returns a random date within this interval using the default random number generator.
Returns a random date within this interval using the supplied random number generator.
Returns a random date within this interval using the default random number generator or null if the interval is empty or unbounded.
Returns a random date within this interval using the supplied random number generator or null if the interval is empty or unbounded.
Returns this interval with the precision reduced to just the date.
Converts this interval to the Duration between the start and end date-time, which are assumed to be in the same time zone. In general, it's more appropriate to calculate duration using Instant or ZonedDateTime as any daylight savings rules won't be taken into account when working with DateTime directly.
Converts this interval to an InstantInterval where both endpoints are in zone.