现在我已经坐了很久。我总能弄清楚,我做错了什么。NSDateFormatter忽略了24小时的时间格式
NSString * dateString = @"2011-11-21 13:00";
NSDateFormatter *serverDateFormatter = [[NSDateFormatter alloc] init];
[serverDateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"];
NSDate *serverDate = [serverDateFormatter dateFromString:dateString];
NSLog(@"%@", serverDate);
输出:
2011-11-21 12:00:00 +0000
为何13:00被转换至12:00?我究竟做错了什么?
dint work。我也设置了NSLocale。仍然给我相同的输出 – Neelesh
你设置了什么? – Almo