---
title: "init(date:style:units:)"
framework: clockkit
role: symbol
role_heading: Initializer
path: "clockkit/clkrelativedatetextprovider/init(date:style:units:)"
---

# init(date:style:units:)

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

## Declaration

```swift
convenience init(date: Date, style: CLKRelativeDateStyle, units calendarUnits: NSCalendar.Unit)
```

## Parameters

- `date`: The date to use for calculations. This parameter must not be nil.
- `style`: The style to use when formatting the relative date value. For a list of possible values, see doc://com.apple.clockkit/documentation/ClockKit/CLKRelativeDateStyle.
- `calendarUnits`: The units to include in the resulting date string. For a list of supported calendar units, see doc://com.apple.clockkit/documentation/ClockKit/CLKRelativeDateTextProvider#Date-Format-Options.

## Discussion

Discussion This initializer produces a text provider that updates automatically as time passes. To create a text provider that produces a static, relative date, use init(date:relativeTo:style:units:) instead. The text provider created by this method uses the default time zone information for the current user. The system formats date values according to the user’s current locale information.

## See Also

### Creating a Text Provider

- [init(date:relativeTo:style:units:)](clockkit/clkrelativedatetextprovider/init(date:relativeto:style:units:).md)
