---
title: "localizedString(from:dateStyle:timeStyle:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/dateformatter/localizedstring(from:datestyle:timestyle:)"
---

# localizedString(from:dateStyle:timeStyle:)

Returns a string representation of a specified date, that the system formats for the current locale using the specified date and time styles.

## Declaration

```swift
class func localizedString(from date: Date, dateStyle dstyle: DateFormatter.Style, timeStyle tstyle: DateFormatter.Style) -> String
```

## Parameters

- `date`: A date.
- `dstyle`: A format style for the date. For possible values, see doc://com.apple.foundation/documentation/Foundation/DateFormatter/Style.
- `tstyle`: A format style for the time. For possible values, see doc://com.apple.foundation/documentation/Foundation/DateFormatter/Style.

## Return Value

Return Value A localized string representation of date using the specified date and time styles.

## Discussion

Discussion This method uses a date formatter configured with the current default settings. The returned string is the same as if you configured and used a date formatter as shown in the following example: NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; formatter.formatterBehavior = NSDateFormatterBehavior10_4; formatter.dateStyle = dateStyle; formatter.timeStyle = timeStyle; NSString *result = [formatter stringForObjectValue:date];

## See Also

### Converting Objects

- [date(from:)](foundation/dateformatter/date(from:).md)
- [string(from:)](foundation/dateformatter/string(from:).md)
- [getObjectValue(_:for:range:)](foundation/dateformatter/getobjectvalue(_:for:range:).md)
