<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StoreKit",
  "identifier" : "/documentation/StoreKit/Product/SubscriptionPeriod/formatted(_:referenceDate:)-3t7wd",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "StoreKit"
    ],
    "preciseIdentifier" : "s:8StoreKit7ProductV18SubscriptionPeriodV9formatted_13referenceDate12FormatOutputQzx_10Foundation0H0VtAJ0I5StyleRzSnyALG0I5InputRtzlF"
  },
  "title" : "formatted(_:referenceDate:)"
}
-->

# formatted(_:referenceDate:)

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

```
@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 [`subscriptionPeriodFormatStyle`](/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

Use the [`formatted(_:referenceDate:)`](/documentation/StoreKit/Product/SubscriptionPeriod/formatted(_:referenceDate:)-3t7wd) method with [`subscriptionPeriodFormatStyle`](/documentation/StoreKit/Product/subscriptionPeriodFormatStyle) to format the subscription period for the App Store locale, as the following example shows.

```swift
// Get a human-readable representation of a subscription period.
subscriptionPeriod.formatted(product.subscriptionPeriodFormatStyle, referenceDate: /* some date */)
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)