-2
简单的一个正在扰乱我,无法解决。我希望将当前的UTC转换为一串数字,但时间不对?当它的00小时它显示为10 ..空间在那里只是为了更容易阅读。NSDate到NSString有时间错误?
登录:
2014-09-01 10:24:16.337 MyApp[44834:60b] 2014-09-01 00:24:16 +0000
2014-09-01 10:24:16.339 MyApp[44834:60b] 20140901 102416
代码:
NSDate *currentDate = [[NSDate alloc] init];
NSLog(@"%@", currentDate);
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyyMMdd HHmmss"];
NSString *currentDateString = [dateFormatter stringFromDate:currentDate];
NSLog(@"%@", currentDateString);
不,这不是错误 2014-09-01 00:24:16 +0000是GMT + 0当前时间+ 0 是您当前的时区+10? http://stackoverflow.com/questions/6229024/nsdate-format-outputting-wrong-date – 2014-09-01 00:36:44