---
title: dateTimeStyle
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/relativedatetimeformatter/datetimestyle-swift.property
---

# dateTimeStyle

The style to use when describing a relative date, for example “yesterday” or “1 day ago”.

## Declaration

```swift
var dateTimeStyle: RelativeDateTimeFormatter.DateTimeStyle { get set }
```

## Discussion

Discussion Default is numeric. let components = DateComponents(weekOfMonth: -1) let formatter = RelativeDateTimeFormatter() formatter.dateTimeStyle = .numeric print(formatter.localizedString(from: components)) // Outputs:  1 week ago To display relative dates using named styles, set this property to named. let components = DateComponents(weekOfMonth: -1) let formatter = RelativeDateTimeFormatter() formatter.dateTimeStyle = .named print(formatter.localizedString(from: components)) // Outputs:  last week

## See Also

### Configuring Formatter Options

- [calendar](foundation/relativedatetimeformatter/calendar.md)
- [locale](foundation/relativedatetimeformatter/locale.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)
