Instance Method

description(with:)

Returns a string representation of the date using the given locale.

Declaration

func description(with locale: Any?) -> String

Parameters

locale

An NSLocale object.

If you pass nil, NSDate formats the date in the same way as the description property.

In OS X v10.4 and earlier, this parameter was an NSDictionary object. If you pass in an NSDictionary object in OS X v10.5, NSDate uses 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].

See Also

Describing Dates

var description: String

A string representation of the date object.

var customPlaygroundQuickLook: PlaygroundQuickLook

A custom playground Quick Look for this object.

Deprecated

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software