format

fun Instant.format(format: DateTimeFormat<DateTimeComponents>, offset: UtcOffset = UtcOffset.ZERO): String(source)

Formats this value using the given format using the given offset.

Equivalent to calling DateTimeFormat.format on format and using DateTimeComponents.setDateTimeOffset in the lambda.

DateTimeComponents.Formats.ISO_DATE_TIME_OFFSET is a format very similar to the one used by toString. The only difference is that Instant.toString adds trailing zeros to the fraction-of-second component so that the number of digits after a dot is a multiple of three.


Formats this value using the given format. Equivalent to calling DateTimeFormat.format on format with this.