dayOfWeek

Returns the day-of-week component of the date.

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   // Getting the day of the week
check(LocalDate(2024, Month.APRIL, 16).dayOfWeek == DayOfWeek.TUESDAY)
check(LocalDate(2024, Month.APRIL, 17).dayOfWeek == DayOfWeek.WEDNESDAY)
check(LocalDate(2024, Month.APRIL, 18).dayOfWeek == DayOfWeek.THURSDAY) 
   //sampleEnd
}