to Epoch Days
Returns the number of days since the epoch day 1970-01-01
.
If the result does not fit in Int, returns Int.MAX_VALUE for a positive result or Int.MIN_VALUE for a negative result.
See also
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*
fun main() {
//sampleStart
// Converting LocalDate values to the number of days since 1970-01-01
check(LocalDate(2024, Month.APRIL, 16).toEpochDays() == 19829)
check(LocalDate(1970, Month.JANUARY, 1).toEpochDays() == 0)
check(LocalDate(1969, Month.DECEMBER, 25).toEpochDays() == -7)
//sampleEnd
}