class DateTimeInterval : TimeInterval<DateTime>
An interval between two arbitrary date-times.
As no UTC offset or time zone is associated with either date-time, it's up to the application to interpret the meaning.
DateTime.MIN and DateTime.MAX are used as sentinels to indicate an unbounded (ie. infinite) start or end.
(iosArm64, iosX64, jvm, macosX64)
<init> |
An interval between two arbitrary date-times. <init>(start: DateTime = UNBOUNDED.start, endExclusive: DateTime = UNBOUNDED.endExclusive) |
(iosArm64, iosX64, jvm, macosX64)
endExclusive |
The end of the interval, exclusive. val endExclusive: DateTime |
(iosArm64, iosX64, jvm, macosX64)
lengthInDays |
Get the number of whole days in the interval. val lengthInDays: LongDays |
(iosArm64, iosX64, jvm, macosX64)
lengthInHours |
Get the number of whole hours in the interval. val lengthInHours: LongHours |
(iosArm64, iosX64, jvm, macosX64)
lengthInMicroseconds |
Get the number of whole microseconds in the interval. val lengthInMicroseconds: LongMicroseconds |
(iosArm64, iosX64, jvm, macosX64)
lengthInMilliseconds |
Get the number of whole milliseconds in the interval. val lengthInMilliseconds: LongMilliseconds |
(iosArm64, iosX64, jvm, macosX64)
lengthInMinutes |
Get the number of whole minutes in the interval. val lengthInMinutes: LongMinutes |
(iosArm64, iosX64, jvm, macosX64)
lengthInMonths |
Get the number of whole months in the interval. val lengthInMonths: IntMonths |
(iosArm64, iosX64, jvm, macosX64)
lengthInNanoseconds |
Get the number of nanoseconds in the interval. val lengthInNanoseconds: LongNanoseconds |
(iosArm64, iosX64, jvm, macosX64)
lengthInSeconds |
Get the number of whole seconds in the interval. val lengthInSeconds: LongSeconds |
(iosArm64, iosX64, jvm, macosX64)
lengthInWeeks |
Get the number of whole weeks in the interval. val lengthInWeeks: LongWeeks |
(iosArm64, iosX64, jvm, macosX64)
lengthInYears |
Get the number of whole years in the interval. val lengthInYears: IntYears |
(iosArm64, iosX64, jvm, macosX64)
start |
The start of the interval, inclusive. val start: DateTime |
(iosArm64, iosX64, jvm, macosX64)
asDuration |
Get the Duration between the start and end date-time, assuming they're 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. fun asDuration(): Duration |
(iosArm64, iosX64, jvm, macosX64)
asPeriod |
Convert the interval into a Period of the same length. fun asPeriod(): Period |
(iosArm64, iosX64, jvm, macosX64)
contains |
Check if this interval contains the given value. fun contains(value: DateTime): Boolean |
(iosArm64, iosX64, jvm, macosX64)
hasUnboundedEnd |
Check if the interval's end is unbounded. In ISO-8601 terminology, this is an "open" end. fun hasUnboundedEnd(): Boolean |
(iosArm64, iosX64, jvm, macosX64)
hasUnboundedStart |
Check if the interval's start is unbounded. In ISO-8601 terminology, this is an "open" start. fun hasUnboundedStart(): Boolean |
(iosArm64, iosX64, jvm, macosX64)
isEmpty |
Check if the interval is empty. fun isEmpty(): Boolean |
(iosArm64, iosX64, jvm, macosX64)
toString |
Convert this interval to a string in ISO-8601 extended format. fun toString(): String |
(iosArm64, iosX64, jvm, macosX64)
EMPTY |
An empty interval. val EMPTY: DateTimeInterval |
(iosArm64, iosX64, jvm, macosX64)
UNBOUNDED |
An unbounded (ie. infinite) interval. val UNBOUNDED: DateTimeInterval |
(jvm)
random |
Return a random date-time within the interval using the supplied random number generator. fun DateTimeInterval.random(random: Random): DateTime |