Possible Duplicate:
Is there a simple way of converting an ISO8601 timestamp to a formatted NSDate?
Converting an ISO 8601 timestamp into an NSDate: How does one deal with the UTC time offset?
i'm trying to convert date time which is in iso 8601 format int local time. convert this:
2012-10-15T09:46:16+02:00
to this:
2012-10-15 11:46:16
i try the following code but gives null back
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];
NSDate *dt = [dateFormatter dateFromString:@"2012-10-15T09:46:16+02:00"];
NSString *dateTime= [NSDateFormatter localizedStringFromDate:dt dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle];
NSLog(@"DATE FORMAT:%@", dateTime);
any idea what am i doing wrong?