O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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;

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required