modelDic.OnSaleCountDownTime -》 是long 型的
NSDate * dataa=[NSDate dateWithTimeIntervalSinceNow:modelDic.OnSaleCountDownTime];//目标时间
NSCalendar * cal = [NSCalendar currentCalendar];
unsigned int unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
NSDateComponents * dd = [cal components:unitFlags fromDate:dataa];
NSInteger year = [dd year];
NSInteger month = [dd month];
NSInteger day = [dd day];
NSInteger hour = [dd hour];
NSInteger minute=[dd minute];
NSInteger second=[dd second];
NSCalendar * calendar = [NSCalendar currentCalendar];
NSDateComponents * components = [[NSDateComponents alloc] init];
[components setYear:year];
[components setMonth:month];
[components setDay:day];
[components setHour:hour];
[components setMinute:minute];
[components setSecond:second];
NSDate * fireDate = [calendar dateFromComponents:components];//目标时间
NSDate * today = [NSDate date];//当前时间
unsigned int unitFlags0 = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
NSDateComponents * d = [calendar components:unitFlags0 fromDate:today toDate:fireDate options:0];//计算时间差
NSInteger abc =[d year]+[d month]+[d day]+[d hour]+[d minute]+[d second];
NSLog(@"%ld",abc);
NSLog(@" %ld年 %ld月 %ld日 %ld时 %ld分 %ld秒",[d year],[d month],[d day],[d hour],[d minute],[d second]);