dayOfYear

The day-of-year component of the date.

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   // Formatting and parsing a date with the day of the year in complex scenarios
val format = DateTimeComponents.Format {
    year(); dayOfYear()
}
val formattedDate = format.format {
    setDate(LocalDate(2023, 2, 13))
    check(year == 2023)
    check(dayOfYear == 44)
}
check(formattedDate == "2023044")
val parsedDate = format.parse("2023044")
check(parsedDate.toLocalDate() == LocalDate(2023, 2, 13))
check(parsedDate.year == 2023)
check(parsedDate.dayOfYear == 44)
check(parsedDate.month == null)
check(parsedDate.dayOfMonth == null)
check(parsedDate.dayOfWeek == null) 
   //sampleEnd
}