13位时间戳转化北京时间
13位时间戳转化北京时间
- (NSString *)dataWithStr:(NSString *)str
{
NSString * data = [NSString stringWithFormat:@"%ld", ([str integerValue] / 1000)];
NSTimeInterval time=[data doubleValue];
NSDate *detaildate=[NSDate dateWithTimeIntervalSince1970:time];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSString *currentDateStr = [dateFormatter stringFromDate: detaildate];
return currentDateStr;
}
oc冒泡排序
if (self.times.count != 0) {
for (NSInteger i = 0; i < self.times.count - 1; i++) {
for (NSInteger j = 0; j < self.times.count - i - 1; j++) {
if ( [ [ [ self.times(at: j) ] ] newAT ].intValue < [ [ [ self.times(at: j + 1) ] ] newAT ].intValue ) {
[self.times exchangeObjectAtIndex:j withObjectAtIndex:j+1];
}
}
}
}
