Published Nov 14, 2023Updated Nov 17, 2023
Contribute to Docs

The DayOfWeek method is used to return the DayOfWeek instance for the weekday number, starting with 1 as Monday.


  • isoDayNumber: An integer value that must correspond to one of the seven days in the DayOfWeek enumeration class. The numbering follows the ISO-8601 weekday number, where Monday is 1 and Sunday is 7.
  • The enumeration class entries have two properties: Name, which is represented by a string, and the Ordinal, which is represented as an integer.


Here is an example of how to call the DayOfWeek method:

import kotlinx.datetime.*
fun main() {
val day = DayOfWeek.of(3)

The output will be:


All contributors

Looking to contribute?

Learn Kotlin on Codecademy