NSDateFormatter显示错误的一年
即时通讯使用xcode 4.5(4G182)与iOS 6. NSDateFormatter在iOS 6中显示错误年份,如何解决?
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateFormat:@"YYYY-MM-dd"];
NSString *str = [dateFormatter stringFromDate:[NSDate date]];
NSLog(@"%@ == %@",str,[[dateFormatter dateFromString:str] description]);
打印出来“ 2012 -09-14 == 2011 -09-13 16:00:00 +0000”
相关分类