I get the following NSString from my web API: @"2013-12-03T19:13:56+00:00"
I want to take this NSString and create the corresponding NSDate by using NSDateFormatter. For the life of me I can not figure out the formatting string that will help me do this. I always get nil. Here is what I am trying:
+ (NSDate *)dateFromUTCFormattedDateString:(NSString *)dateString
{
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
[dateFormatter setTimeZone:timeZone];
[dateFormatter setDateFormat:@"YYYY-MM-ddThh:mm:ssTZD"];
// Apply the date formatter and return it.
return [dateFormatter dateFromString:dateString];
}