fromEpochDays

actual fun fromEpochDays(epochDays: Int): LocalDate(source)
expect fun fromEpochDays(epochDays: Int): LocalDate(source)

Returns a LocalDate that is epochDays number of days from the epoch day 1970-01-01.

See also

Throws

if the result exceeds the platform-specific boundaries of LocalDate.

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 and back
check(LocalDate.fromEpochDays(0) == LocalDate(1970, Month.JANUARY, 1))
val randomEpochDay = Random.nextInt(-50_000..50_000)
val randomDate = LocalDate.fromEpochDays(randomEpochDay)
check(randomDate.toEpochDays() == randomEpochDay) 
   //sampleEnd
}
actual fun fromEpochDays(epochDays: Int): LocalDate(source)
actual fun fromEpochDays(epochDays: Int): LocalDate(source)