<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Date/FormatStyle/Symbol/Year/padded(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation4DateV11FormatStyleV6SymbolV4YearV6paddedyAISiFZ"
  },
  "title" : "padded(_:)"
}
-->

# padded(_:)

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

```
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(_:)`](/documentation/Foundation/Date/FormatStyle/Symbol/Year/padded(_:)) to display a year using three or more digits, zero-padded if necessary. For example, `002`, `020`, `201`, `2017`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)