---
title: "localizedString(fromTimeInterval:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/relativedatetimeformatter/localizedstring(fromtimeinterval:)"
---

# localizedString(fromTimeInterval:)

Formats the specified time interval using the formatter’s calendar.

## Declaration

```swift
func localizedString(fromTimeInterval timeInterval: TimeInterval) -> String
```

## Parameters

- `timeInterval`: The time interval to format.

## Return Value

Return Value A string that represents the formatted time interval.

## Discussion

Discussion The formatter interprets a negative time interval as a date in the past. let formatter = RelativeDateTimeFormatter() print(formatter.localizedString(fromTimeInterval: -120)) // Outputs:  2 minutes ago

## See Also

### Converting Dates to Formatted Strings

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