format

abstract fun format(value: T): String(source)

Formats the given value into a string using this format.

Throws

if the value does not contain all the information required by the format.

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.test.*
fun main() { 
   //sampleStart 
   // Formatting a date using a predefined format
check(LocalDate.Formats.ISO.format(LocalDate(2021, 2, 7)) == "2021-02-07") 
   //sampleEnd
}