description(with:)
Returns a string representation of the date using the given locale.
Declaration
func description(with locale: Any?) -> StringParameters
- locale:
An
NSLocaleobject.If you pass
nil,NSDateformats the date in the same way as the Description property.In OS X v10.4 and earlier, this parameter was an
NSDictionaryobject. If you pass in anNSDictionaryobject in OS X v10.5,NSDateuses the default user locale—the same as if you passed in[NSLocale currentLocale].
Return Value
A string representation of the receiver, using the given locale, or if the locale argument is nil, in the international format YYYY-MM-DD HH:MM:SS ±HHMM, where ±HHMM represents the time zone offset in hours and minutes from UTC (for example, “2001-03-24 10:45:32 +0600”)
Discussion
In OS X v10.4 and earlier, localeDictionary is an NSDictionary object containing locale data. To use the user’s preferences, you can use [[NSUserDefaults standardUserDefaults] dictionaryRepresentation].