代码语言:javascript复制
//时间戳处理
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];