Can someone please tell me how I can convert this string:
2011-07-25T10:12:59-05:00
to an NSDate object? 开发者_如何转开发I have converted GMT date strings before with an NSDateFormat that looked like @"yyyy-MM-dd'T'HH:mm:ss.SSSS", but I have no idea how to configure it for this string.
Also, what do I set my [NSDateFormatter timeZone] to be?
Any help will be greatly appreciated. Thanks!
Problem Solved !
You can convert your string to NSDate this way,
NSString *dateString = @"2011-07-25T10:12:59-05:00";
NSDateFormatter *df = [NSDateFormatter new];
[df setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssz"];
NSDate *date = [df dateFromString:dateString];
NSLog(@"%@", date);
精彩评论