class DateTimeInterval : TimeInterval<DateTime>
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.
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
<init> |
An interval between two date-times, assumed to be at the same offset from UTC. <init>(start: DateTime = UNBOUNDED.start, endExclusive: DateTime = UNBOUNDED.endExclusive) |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
endExclusive |
The end of the interval, exclusive. val endExclusive: DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInDays |
Get the number of whole days in the interval. val lengthInDays: LongDays |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInHours |
Get the number of whole hours in the interval. val lengthInHours: LongHours |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInMicroseconds |
Get the number of whole microseconds in the interval. val lengthInMicroseconds: LongMicroseconds |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInMilliseconds |
Get the number of whole milliseconds in the interval. val lengthInMilliseconds: LongMilliseconds |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInMinutes |
Get the number of whole minutes in the interval. val lengthInMinutes: LongMinutes |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInMonths |
Get the number of whole months in the interval. val lengthInMonths: IntMonths |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInNanoseconds |
Get the number of nanoseconds in the interval. val lengthInNanoseconds: LongNanoseconds |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInSeconds |
Get the number of whole seconds in the interval. val lengthInSeconds: LongSeconds |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInWeeks |
Get the number of whole weeks in the interval. val lengthInWeeks: LongWeeks |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
lengthInYears |
Get the number of whole years in the interval. val lengthInYears: IntYears |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
start |
The start of the interval, inclusive. val start: DateTime |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
asDuration |
Converts this interval to 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, tvosArm64, tvosX64, watchosArm64, watchosX86)
asPeriod |
Convert the interval into a Period of the same length. fun asPeriod(): Period |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
contains |
Check if this interval contains the given value. fun contains(value: DateTime): Boolean |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
equals |
fun equals(other: Any?): Boolean |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
hashCode |
fun hashCode(): Int |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
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, tvosArm64, tvosX64, watchosArm64, watchosX86)
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, tvosArm64, tvosX64, watchosArm64, watchosX86)
isEmpty |
Check if the interval is empty. fun isEmpty(): Boolean |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
toString |
Converts this interval to a string in ISO-8601 extended format. fun toString(): String |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
EMPTY |
An empty interval. val EMPTY: DateTimeInterval |
(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86)
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 |
(jvm)
randomOrNull |
Return a random date-time within the interval using the supplied random number generator or
fun DateTimeInterval.randomOrNull(random: Random): DateTime? |