代码:
NSString *ds = @"2013-02-25";
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"YYYY-MM-dd"];
NSDate* date = [formatter dateFromString:ds];
NSLog(@"%@", date); //2012-02-24 16:00:00 +0000
[formatter setDateFormat:@"MMM dd, YYYY"];
NSLog(@"%@", [formatter stringFromDate:date]); //Feb 25, 2012
我做错了什么吗?还是 iOS 6 SDK 错误?