https://kotlinlang.org logo
#kotlinx-datetime
Title
# kotlinx-datetime
k

kevin.cianfarini

01/24/2023, 6:35 PM
How could I do arithmetic on a
DateTimePeriod
? I want to figure out how many
DateTimeUnit
a
DateTimePeriod
is composed of, for example. I would hope/think something like this would be available but I’m not sure if it’s explicitly omitted.
Copy code
val period = someInstant.periodUntil(otherInstant)
val unit = DateTimeUnit.MINUTE * 30

return period.div(unit) // Not available.
Never mind, Instant.until is what I want!
4 Views