toString
Converts this LocalIsoWeekDate to a string in the ISO 8601 week date format (for example, 2023-W42-3).
See ISO-8601-1:2019, 5.2.4.1b), using the "expanded calendar year" extension from 5.2.4.3a), generalized to any number of digits in the year for years that fit in an Int.
See also
for the dual operation: obtaining LocalIsoWeekDate from a string.
Samples
import kotlinx.datetime.*
import kotlin.test.*
fun main() {
//sampleStart
// Converting a LocalIsoWeekDate to a string
check("2004-W53-7" == LocalDate(2005, 1, 2).toLocalIsoWeekDate().toString())
check("2009-W01-1" == LocalDate(2008, 12, 29).toLocalIsoWeekDate().toString())
//sampleEnd
}Content copied to clipboard