---
title: RelativeDateTimeFormatter
framework: foundation
role: symbol
role_heading: Class
path: foundation/relativedatetimeformatter
---

# RelativeDateTimeFormatter

A formatter that creates locale-aware string representations of a relative date or time.

## Declaration

```swift
class RelativeDateTimeFormatter
```

## Overview

Overview Use the strings that the formatter produces, such as “1 hour ago”, “in 2 weeks”, “yesterday”, and “tomorrow” as standalone strings. Embedding them in other strings may not be grammatically correct.

## Topics

### Converting Dates to Formatted Strings

- [localizedString(for:relativeTo:)](foundation/relativedatetimeformatter/localizedstring(for:relativeto:).md)
- [localizedString(from:)](foundation/relativedatetimeformatter/localizedstring(from:).md)
- [localizedString(fromTimeInterval:)](foundation/relativedatetimeformatter/localizedstring(fromtimeinterval:).md)
- [string(for:)](foundation/relativedatetimeformatter/string(for:).md)

### Configuring Formatter Options

- [calendar](foundation/relativedatetimeformatter/calendar.md)
- [locale](foundation/relativedatetimeformatter/locale.md)
- [dateTimeStyle](foundation/relativedatetimeformatter/datetimestyle-swift.property.md)
- [RelativeDateTimeFormatter.DateTimeStyle](foundation/relativedatetimeformatter/datetimestyle-swift.enum.md)
- [unitsStyle](foundation/relativedatetimeformatter/unitsstyle-swift.property.md)
- [RelativeDateTimeFormatter.UnitsStyle](foundation/relativedatetimeformatter/unitsstyle-swift.enum.md)
- [formattingContext](foundation/relativedatetimeformatter/formattingcontext.md)

## Relationships

### Inherits From

- [Formatter](foundation/formatter.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Dates and times

- [DateFormatter](foundation/dateformatter.md)
- [DateComponentsFormatter](foundation/datecomponentsformatter.md)
- [DateIntervalFormatter](foundation/dateintervalformatter.md)
- [ISO8601DateFormatter](foundation/iso8601dateformatter.md)
