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
NSDate
object set to the date and time specified by a given string.
+ (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.
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.