---
title: "formatted(_:referenceDate:)"
framework: storekit
role: symbol
role_heading: Instance Method
path: "storekit/product/subscriptionperiod/formatted(_:referencedate:)-3t7wd"
---

# formatted(_:referenceDate:)

Formats the subscription period using a format style that takes a date range as an input.

## Declaration

```swift
@backDeployed(before: iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0, macCatalyst 16.0)
func formatted<S>(_ format: S, referenceDate: Date = .now) -> S.FormatOutput where S : FormatStyle, S.FormatInput == Range<Date>
```

## Parameters

- `format`: A format style that has a date range input. The format style for a product is doc://com.apple.storekit/documentation/StoreKit/Product/subscriptionPeriodFormatStyle.
- `referenceDate`: The lower bound date for a date range representing the subscription period. The default value is doc://com.apple.documentation/documentation/Foundation/Date/now.

## Discussion

Discussion Use the formatted(_:referenceDate:) method with subscriptionPeriodFormatStyle to format the subscription period for the App Store locale, as the following example shows. // Get a human-readable representation of a subscription period. subscriptionPeriod.formatted(product.subscriptionPeriodFormatStyle, referenceDate: /* some date */)

## See Also

### Formatting the subscription period

- [formatted(_:referenceDate:)](storekit/product/subscriptionperiod/formatted(_:referencedate:)-8s3ar.md)
