字符串转时间 时间格式
NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];
[inputFormatter setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"]]; @"en_US"
[inputFormatter setDateFormat:@"yyyy.MM.dd HH:mm:ss"]; // 字符串里时间的格式 这里是 "2016.05.18 10:50:00";
NSDate* inputDate = [inputFormatter dateFromString:self.time];
NSLog(@"date = %@ self.date = %@ ", inputDate , self.time );
修改时间的格式
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setLocale:[NSLocale currentLocale]];
[outputFormatter setDateFormat:@"yyyy年MM月dd日 HH时mm分ss秒"];
NSString *str = [outputFormatter stringFromDate:inputDate];
NSLog(@"testDate:%@", str);