---
title: "year(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/date/formatstyle/attributed-swift.struct/year(_:)"
---

# year(_:)

Change the representation of the year in the format.

## Declaration

```swift
func year(_ format: Date.FormatStyle.Symbol.Year = .defaultDigits) -> Date.FormatStyle.Attributed
```

## Parameters

- `format`: Set the symbol representation or pass nil to remove it.
