计算时间差

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

 NSDateFormatter* dateFormat = [[NSDateFormatter alloc] init];
                                                 [dateFormat setDateFormat:@"yyyy-MM-dd"];
                                                 NSDate *insert = [dateFormat dateFromString:model.inserttime];
                                                 
                                                 NSTimeInterval inserttime = [insert timeIntervalSince1970];
                                                 //相差8个小时
                                                 inserttime = inserttime + 29760;
                                                 NSTimeInterval LocalTime = [[NSDate date] timeIntervalSince1970];
                                                 //86400 一天的秒数
                                                 int day = LocalTime - inserttime - 86400;