/**
*? 計(jì)算剩余時間
*
*? @param endTime? 結(jié)束日期
*
*? @return 剩余時間
*/
- (NSString *)getCountDownStringWithEndTime:(NSString *)endTime { NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm"]; NSDate *now = [NSDate date]; NSTimeZone *zone = [NSTimeZone systemTimeZone];//設(shè)置時區(qū)
NSInteger interval = [zone secondsFromGMTForDate: now];
NSDate *localDate = [now dateByAddingTimeInterval: interval];
endTime = [NSString stringWithFormat:@"%@ 23:59", endTime];
NSDate *endDate = [dateFormatter dateFromString:endTime];
NSInteger endInterval = [zone secondsFromGMTForDate: endDate];
NSDate *end = [endDate dateByAddingTimeInterval: endInterval];
NSUInteger voteCountTime = ([end timeIntervalSinceDate:localDate]) / 3600 / 24;
NSString *timeStr = [NSString stringWithFormat:@"%ld", voteCountTime];
return timeStr;
}