core / io.islandtime.ranges / DateTimeInterval / asDuration

asDuration

(iosArm64, iosX64, jvm, macosX64, tvosArm64, tvosX64, watchosArm64, watchosX86) fun asDuration(): Duration

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.

Exceptions

UnsupportedOperationException - if the interval isn't bounded