根據時間戳返回時間間隔
+ (NSString *)getDatePlaySeconds:(NSString *)playSeconds{
NSString *timeStr;
NSTimeInterval time=[playSeconds doubleValue]+28800;
NSDate *detaildate=[NSDatedateWithTimeIntervalSince1970:time];
//當前時間
NSDate *newDate = [NSDatedate];
NSTimeZone *zone = [NSTimeZonesystemTimeZone];
NSTimeInterval timeSystem = [zone
NSDate *nowDate = [newDate dateByAddingTimeInterval:timeSystem];
//獲取時間間隔
NSTimeInterval timeCount = [nowDate timeIntervalSinceDate:detaildate];
if (timeCount < 60) {
timeStr = @"剛剛";
} elseif (timeCount >= 60 && timeCount < 3600) {
timeStr = [
} elseif(timeCount > 3600 && timeCount < 3600 * 24) {
timeStr = [NSStringstringWithFormat:@"%d小時前", (int)timeCount / 3600];
}else{
NSString *str = [NSStringstringWithFormat:@"%@", detaildate];
timeStr = [str substringWithRange
}
return timeStr;
}