<!--
{
  "availability" : [
    "watchOS: 2.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "ClockKit",
  "identifier" : "/documentation/ClockKit/CLKRelativeDateTextProvider",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ClockKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CLKRelativeDateTextProvider"
  },
  "title" : "CLKRelativeDateTextProvider"
}
-->

# CLKRelativeDateTextProvider

A formatted string that conveys the difference in time between the current date and a date that you specify.

```
class CLKRelativeDateTextProvider
```

## Overview

You use a relative date text provider to implement timers or other relative time values in an efficient way. Instead of using multiple timeline entries to replicate a countdown timer, create a single timeline entry with a relative date text provider. When the user views the clock face, ClockKit automatically updates the relative time value in your complication, providing up-to-date time information.

When creating the formatted string, the relative date text provider creates the longest string that fits in the given space. It includes as many of the requested date elements as it can, but may truncate elements or use abbreviations as needed. The formatted string takes into account the user’s region and locale settings.

### Date Format Options

When creating a `CLKRelativeDateTextProvider` object, you must specify which calendar units you want included in the resulting date. Only the following calendar units are supported:

- <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSYearCalendarUnit>
- <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSMonthCalendarUnit>
- <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSWeekOfMonthCalendarUnit>
- <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSDayCalendarUnit>
- <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSHourCalendarUnit>
- <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSMinuteCalendarUnit>
- <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSSecondCalendarUnit>

> Note:
> When creating a relative date provider using the ``doc://com.apple.clockkit/documentation/ClockKit/CLKRelativeDateStyle/timer`` style, only the <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSHourCalendarUnit>, <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSMinuteCalendarUnit>, and <doc://com.apple.documentation/documentation/Foundation/NSCalendar/Unit/NSSecondCalendarUnit> units are supported.

All other calendar units are ignored.

The format of the relative time value is dependent on the date style you choose when creating the text provider. For a list of possible styles and examples of each, see [`CLKRelativeDateStyle`](/documentation/ClockKit/CLKRelativeDateStyle).

## Topics

### Creating a Text Provider

[`init(date:style:units:)`](/documentation/ClockKit/CLKRelativeDateTextProvider/init(date:style:units:))

Creates a text provider that shows the difference between the current time and the specified date.

[`initWithDate:style:units:`](/documentation/ClockKit/CLKRelativeDateTextProvider/initWithDate:style:units:)

Creates a text provider that shows the difference between the current time and the specified date.

[`init(date:relativeTo:style:units:)`](/documentation/ClockKit/CLKRelativeDateTextProvider/init(date:relativeTo:style:units:))

Creates a text provider that shows the difference in time between the provided dates.

[`initWithDate:relativeToDate:style:units:`](/documentation/ClockKit/CLKRelativeDateTextProvider/initWithDate:relativeToDate:style:units:)

Creates a text provider that shows the difference in time between the provided dates.

### Getting the Date Information

[`date`](/documentation/ClockKit/CLKRelativeDateTextProvider/date)

The target date to use for calculations.

[`relativeToDate`](/documentation/ClockKit/CLKRelativeDateTextProvider/relativeToDate)

The end date that the text provider uses when calculating a fixed, relative date.

[`relativeDateStyle`](/documentation/ClockKit/CLKRelativeDateTextProvider/relativeDateStyle)

The formatting style to use for the relative time value.

[`calendarUnits`](/documentation/ClockKit/CLKRelativeDateTextProvider/calendarUnits)

The calendar units to include in the formatted string.

### Constants

[`CLKRelativeDateStyle`](/documentation/ClockKit/CLKRelativeDateStyle)

Constants indicating the formatting style for the relative date values.



---

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)