---
title: "init(anchor:allowedFields:presentation:unitsStyle:locale:calendar:capitalizationContext:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/date/anchoredrelativeformatstyle/init(anchor:allowedfields:presentation:unitsstyle:locale:calendar:capitalizationcontext:)"
---

# init(anchor:allowedFields:presentation:unitsStyle:locale:calendar:capitalizationContext:)

Create a relative format style that is detached from the system time, and instead formats an anchor date relative to the format input.

## Declaration

```swift
init(anchor: Date, allowedFields: Set<Date.AnchoredRelativeFormatStyle.Field>, presentation: Date.AnchoredRelativeFormatStyle.Presentation = .numeric, unitsStyle: Date.AnchoredRelativeFormatStyle.UnitsStyle = .wide, locale: Locale = .autoupdatingCurrent, calendar: Calendar = .autoupdatingCurrent, capitalizationContext: FormatStyleCapitalizationContext = .unknown)
```

## Parameters

- `anchor`: The date the formatted output is referring to.
