Name

NSDateFormatter — Mac OS X 10.0

Synopsis

This class is used to convert NSDate values into a human-readable date and time string, as well as to convert textual date and time representations into NSDate objects. NSDateFormatter is quite flexible in terms of the variety of supported textual representations, including such standards as 1/1/02, January 1, 2002, and natural language expressions such as “Today” or “Tomorrow”. NSDateFormatter is used primarily by NSTextFieldCell instances to present date information to the user in an appropriate format.

image with no caption

@interface NSDateFormatter : NSFormatter
                                  // Initializers
   - (id)initWithDateFormat:(NSString *)format 
                                 allowNaturalLanguage:(BOOL)flag;
                                  // Instance Methods
   - (BOOL)allowsNaturalLanguage;
   - (NSString *)dateFormat;

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.