A formatter that converts between dates and their textual representations.
Mac Catalyst 13.0+
Instances of NSDateFormatter create string representations of NSDate objects, and convert textual representations of dates and times into NSDate objects. For user-visible representations of dates and times, NSDateFormatter provides a variety of localized presets and configuration options. For fixed format representations of dates and times, you can specify a custom format string.
If you need to define a format that cannot be achieved using the predefined styles, you can use the setLocalizedDateFormatFromTemplate: to specify a localized date format from a template.
Working With Fixed Format Date Representations
When working with fixed format dates, such as RFC 3339, you set the dateFormat property to specify a format string. For most fixed formats, you should also set the locale property to a POSIX locale ("en_US_POSIX"), and set the timeZone property to UTC.
On iOS 7 and later NSDateFormatter is thread safe.
In macOS 10.9 and later NSDateFormatter is thread safe so long as you are using the modern behavior in a 64-bit app.
On earlier versions of the operating system, or when using the legacy formatter behavior or running in 32-bit in macOS, NSDateFormatter is not thread safe, and you therefore must not mutate a date formatter simultaneously from multiple threads.