year
Returns the year component of the date.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*
fun main() {
//sampleStart
// Getting the year
check(LocalDate(2024, Month.APRIL, 16).year == 2024)
check(LocalDate(0, Month.APRIL, 16).year == 0)
check(LocalDate(-2024, Month.APRIL, 16).year == -2024)
//sampleEnd
}