我在控制台中记录了这个日期字符串:
2013-8-11 10:00PM
我运行此 dateFormatter 以使其成为 NSDate:
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd hh:mm a"];
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"MST"]];
NSDate *openDate = [dateFormatter dateFromString:adjustedOpenDateString];
NSLog(@"DEALWITHTIMESTRINGS = open, now, close %@,%@,%@", openDate,[NSDate date], closeDate);
但是当我记录它时,openDate 显示为 NULL。closeDate 也是如此。