Contents

padded(_:)

Returns a custom format style that portrays the year of the calendar system of the provided length, zero-padded if necessary.

Declaration

static func padded(_ length: Int) -> Date.FormatStyle.Symbol.Year

Parameters

  • length:

    The length of the string to display a calendar year.

Return Value

A custom year format style that portrays the year of the calendar system with the provided length.

Discussion

Use padded(_:) to display a year using three or more digits, zero-padded if necessary. For example, 002, 020, 201, 2017.

See Also

Modifying a Year