我有以下代码
NSString *dateString = @"2013-05-24T10:30:00+0200";
NSLog(@"date string before format %@", dateString);
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ssZZZ"];
NSDate *date = [dateFormatter dateFromString:dateString];
dateString = [dateFormatter stringFromDate:date];
NSLog(@"date string after format %@", dateString);
输出是:
date string before format 2013-05-24T10:30:00+0200
date string after format 2013-05-24T09:30:00+0100
为什么它显示 10:30 然后 9:30 ?!!!