<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.6.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/DateFormatter/localizedString(from:dateStyle:timeStyle:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDateFormatter(cm)localizedStringFromDate:dateStyle:timeStyle:"
  },
  "title" : "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.

```
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 [`DateFormatter.Style`](/documentation/Foundation/DateFormatter/Style).

`tstyle`

A format style for the time. For possible values, see [`DateFormatter.Style`](/documentation/Foundation/DateFormatter/Style).

## Return Value

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

## 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:

```objc
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.formatterBehavior = NSDateFormatterBehavior10_4;
formatter.dateStyle = dateStyle;
formatter.timeStyle = timeStyle;
NSString *result = [formatter stringForObjectValue:date];
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)