2016.8.24
//计算还款日与当前时间的差
- (int)intervalSinceNow: (NSString*) theDate {
NSDateFormatter*formatter=[[NSDateFormatteralloc]init];
[formattersetDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate*date=[formatterdateFromString:theDate];
NSString*string = [formatterstringFromDate:[NSDatedate]];
NSLog(@"%@", string);
NSTimeIntervallate=[datetimeIntervalSince1970]*1;
NSDate* dat = [NSDatedateWithTimeIntervalSinceNow:0];
NSTimeIntervalnow = [dattimeIntervalSince1970]*1;
NSString*timeString =@"";
NSTimeIntervalcha = now-late;
if(cha/86400>1) {
timeString = [NSStringstringWithFormat:@"%f", cha/86400];
timeString = [timeStringsubstringToIndex:timeString.length-7];
return[timeStringintValue];
}
return-1;
}