Type Method

dateWithNaturalLanguageString:

Creates and returns a date object set to the date and time specified by a given string.

Declaration

+ (id)dateWithNaturalLanguageString:(NSString *)string;

Parameters

string

A string that contains a colloquial specification of a date, such as “last Tuesday at dinner,” “3pm December 31, 2001,” “12/31/01,” or “31/12/01.”

Return Value

A new NSDate object set to the current date and time specified by string.

Discussion

This method supports only a limited set of colloquial phrases, primarily in English. It may give unexpected results, and its use is strongly discouraged. To create a date object from a string, you should use a date formatter object instead (see NSDateFormatter and Data Formatting Guide).

In parsing the string, this method uses the date and time preferences stored in the user’s defaults database. (See dateWithNaturalLanguageString:locale: for a list of the specific items used.)

See Also

Legacy Operations

+ dateWithNaturalLanguageString:locale:

Creates and returns a date object set to the date and time specified by a given string.

Deprecated
+ dateWithString:

Creates and returns a date object with a date and time value specified by a given string in the international string representation format (YYYY-MM-DD HH:MM:SS ±HHMM).

Deprecated
- initWithString:

Returns a date object initialized with a date and time value specified by a given string in the international string representation format.

Deprecated
- addTimeInterval:

Returns a new date object that is set to a given number of seconds relative to the receiver.

Deprecated
- dateWithCalendarFormat:timeZone:

Converts the receiver to a calendar date with a given format string and time zone.

Deprecated
- descriptionWithCalendarFormat:timeZone:locale:

Returns a string representation of the date formatted as specified by given conversion specifiers.

Deprecated