2023-12-23

On NS*DateFormatters

There now exists NSDateFormatter and NSISO8601DateFormatter and their behaviour when a timezone is not set is not the same: NSDateFormatter produces strings formatted for local time while NSISO8601DateFormatter produces string formatted for UTC.

As an example, given a date-time of 2000-12-31T23:00:00Z

NSDateFormatter with no timezone set and full styles:
Monday, January 1, 2001 at 10:00:00 AM Australian Eastern Daylight Time
NSISO8601DateFormatter with no timezone set:
2000-12-31T23:00:00Z

Note that NSDateFormatter "applies" my local timezone automatically whereas NSISO8601DateFormatter doesn't. Sidebar: it seems that while NSDate carries no timezone information, it is always interpreted as UTC time.