Reputation: 473
What is the NSFormat required for a string like this?
Fri, 15 Jun 2012 15:37:38 GMT
I'm trying to create a NSDate object from it. thanks
Upvotes: 3
Views: 260
Reputation: 21221
Use the following
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss z"];
NSDate *date = [formatter dateFromString:@"Fri, 15 Jun 2012 15:37:38 GMT"];
NSLog([date description]); //2012-06-15 15:37:38 +0000
Upvotes: 4