inWholeDays

The value of this duration expressed as a Long number of days.

The part of this duration that is smaller than a day becomes a fractional part of the result and then is truncated (rounded towards zero).

Note that a day in this conversion always represents exactly 24 hours. This is different from calendar days which may be longer or shorter than 24 hours when a daylight saving transition happens on that day.

An infinite duration value is converted either to Long.MAX_VALUE or Long.MIN_VALUE depending on its sign.

Since Kotlin

1.6

Samples

import kotlin.test.*
import kotlin.time.*
import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.hours
import kotlin.time.Duration.Companion.microseconds
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.minutes
import kotlin.time.Duration.Companion.nanoseconds
import kotlin.time.Duration.Companion.seconds

fun main() { 
   //sampleStart 
   println(23.5.hours.inWholeDays) // 0
println(48.hours.inWholeDays) // 2

println("(-Duration.INFINITE).inWholeDays == Long.MIN_VALUE is ${(-Duration.INFINITE).inWholeDays == Long.MIN_VALUE}") // true 
   //sampleEnd
}