---
title: "formatted(_:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/datecomponents/formatted(_:)"
---

# formatted(_:)

Converts self to its textual representation.

## Declaration

```swift
func formatted<F>(_ format: F) -> F.FormatOutput where F : FormatStyle, F.FormatInput == DateComponents
```

## Parameters

- `format`: The format for formatting self.

## Return Value

Return Value A representation of self using the given format. The type of the representation is specified by FormatStyle.FormatOutput.
