iPhone NSDateFormatter Timezone Conversion
Posted
by
MobileDeveloperTips
on Stack Overflow
See other posts from Stack Overflow
or by MobileDeveloperTips
Published on 2010-06-22T15:42:48Z
Indexed on
2012/12/18
23:03 UTC
Read the original article
Hit count: 205
iphone
|nsdateformatter
I am trying to create a formatter that will convert the date format shown to an NSDate object:
NSString *dateStr = @"2010-06-21T19:00:00-05:00";
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];
NSDate *date = [dateFormat dateFromString:dateStr];
The issue is the timezone -05:00, which is not parsed properly with the format above. Any suggestions?
© Stack Overflow or respective owner