day Of Year
Returns the day-of-year (1..366
) component of the date.
Samples
import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*
fun main() {
//sampleStart
// Getting the 1-based day of the year
check(LocalDate(2024, Month.APRIL, 16).dayOfYear == 107)
check(LocalDate(2024, Month.JANUARY, 1).dayOfYear == 1)
check(LocalDate(2024, Month.DECEMBER, 31).dayOfYear == 366)
//sampleEnd
}