时间戳转化为日期TimeStamp转NSDate转NSString

 //时间戳处理
NSInteger time = [self.album.updatedAt integerValue] / 1000;
NSNumber *timer = [NSNumber numberWithInteger:time];
NSTimeInterval interval = [timer doubleValue];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:interval];
//设置日期格式
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"yyyy-MM-dd"];
NSString *str = [formatter stringFromDate:date];
[formatter release];
上一篇:iOS UIAlertController跟AlertView用法一样 && otherButtonTitles:(nullable NSString *)otherButtonTitles, ... 写法


下一篇:Bootstrap的Modal与WebUploader联用的问题及办法