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
class func localizedString(from date: Date, dateStyle dstyle: DateFormatter.Style, timeStyle tstyle: DateFormatter.Style) -> StringParameters
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:
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.formatterBehavior = NSDateFormatterBehavior10_4;
formatter.dateStyle = dateStyle;
formatter.timeStyle = timeStyle;
NSString *result = [formatter stringForObjectValue:date];