I have the following NSString:
NSString * dateString = @"2012-01-24T14:59:01Z";
I want to create an NSDate from that string. I looked up the NSDate Class Reference and thought of using dateWithNaturalLanguageString::
Creates and returns an
NSDateobject set to the date and time
specified by a given string.
+ (id)dateWithNaturalLanguageString:(NSString *)stringParameters
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 newNSDateobject set to the current
date and time specified by string.
However, when I’m trying to use it like this:
NSDate * date = [NSDate dateWithNaturalLanguageString:dateString];
I’m getting the following error:
No known class method for selector ‘dateWithNaturalLanguageString:’
Found exactly what I was looking for here. It’s an RFC 3339 date-time.