Instance Method


Initializes and returns an NSDateFormatter instance that uses the OS X 10.0 formatting behavior and the given date format string in its conversions.


- (id)initWithDateFormat:(NSString *)format allowNaturalLanguage:(BOOL)flag;



The format for the receiver. See Data Formatting Guide for a list of conversion specifiers permitted in date format strings.


A flag that specifies whether the receiver should process dates entered as expressions in the vernacular (for example, "tomorrow")—YES means that it should.

Return Value

An initialized NSDateFormatter instance that uses format in its conversions and that uses the OS X 10.0 formatting behavior.


NSDateFormatter attempts natural-language processing only after it fails to interpret an entered string according to format. Natural-language processing supports only a limited set of colloquial phrases, primarily in English. It may give unexpected results, and its use is strongly discouraged.

The following example creates a date formatter with the format string (for example) “Mar 15 1994” and then associates the formatter with the cells of a form (contactsForm):

NSDateFormatter *dateFormat = [[NSDateFormatter alloc]
    initWithDateFormat:@"%b %d %Y" allowNaturalLanguage:NO];
[[contactsForm cells] makeObjectsPerformSelector:@selector(setFormatter:)

Special Considerations

You cannot use this method to initialize a formatter with the OS X 10.4 formatting behavior, you must use init.

See Also



Indicates whether the formatter generates the deprecated calendar date type.