format

Uses this format to format an unstructured DateTimeComponents.

block is called on an initially-empty DateTimeComponents before formatting.

Example:

// Mon, 16 Mar 2020 23:59:59 +0300
DateTimeComponents.Formats.RFC_1123.format {
setDateTime(LocalDateTime(2020, 3, 16, 23, 59, 59, 999_999_999))
setOffset(UtcOffset(hours = 3))
}

Throws

if some values needed for the format are not present or can not be formatted: for example, trying to format DateTimeFormatBuilder.WithDate.monthName using a DateTimeComponents.monthNumber value of 20.