How to convert a UTC date to NSDate?
- by Sheehan Alam
I have a string that is UTC and would like to convert it to an NSDate.
static NSDateFormatter* _twitter_dateFormatter;
[_twitter_dateFormatter setFormatterBehavior:NSDateFormatterBehaviorDefault];
[_twitter_dateFormatter setDateFormat:@"EEE MMM dd HH:mm:ss ZZZ yyyy"];
[_twitter_dateFormatter setLocale:_en_us_locale];
NSDate *d = [_twitter_dateFormatter dateFromString:sDate];
When I go through the debugger *d is nil even though sDate is "2010-03-24T02:35:57Z"
Not exactly sure what I'm doing wrong.