Kotlin Sample extending Java 8 Temporal classes to render an ISO formatted string


Example

With this declaration:

fun Temporal.toIsoString(): String = DateTimeFormatter.ISO_INSTANT.format(this)

You can now simply:

val dateAsString = someInstant.toIsoString()