---
title: "init(pattern:locale:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/duration/timeformatstyle/init(pattern:locale:)"
---

# init(pattern:locale:)

Creates a time format style using the provided pattern and optional locale.

## Declaration

```swift
init(pattern: Duration.TimeFormatStyle.Pattern, locale: Locale = .autoupdatingCurrent)
```

## Parameters

- `pattern`: A Pattern that specifies the units to include in the displayed string and the behavior of the units.
- `locale`: The Locale used to create the string representation of the duration. This parameter defaults to doc://com.apple.documentation/documentation/Foundation/Locale/autoupdatingCurrent.

## See Also

### Creating a time format style

- [Duration.TimeFormatStyle.Pattern](swift/duration/timeformatstyle/pattern-swift.struct.md)
