Now that we know a bit about NSDate and NSDateComponents, let’s actually get a readable date in our Swift app, shall we? This is the job of NSDateFormatter. NSDateFormatter is a class that can take an NSDate, and output a String describing that time/date as its format instructions dictate. In other words, you tell it what you want to know, and it will give you a String that says that. It has a few pretty useful built-in formats, and the capability to accept a custom date format string.
There’s not too much to the actual creation of an NSDateFormatter object. It pretty much just has an empty initializer (and an NSCoding one, but we aren’t covering NSCoding today). After initializing your NSDateFormatter, you set the appropriate style for the date and time, and that’s all you need.