- (NSString*)intervalFromLastDate: (NSString*) dateString1toTheDate:(NSString*) dateString2
{
NSDateFormatter*date=[[NSDateFormatteralloc]init];
[datesetDateFormat:@"yyyy-MM-dd"];
NSDate*d1=[datedateFromString:dateString1];
NSTimeIntervallate1=[d1timeIntervalSince1970]*1;
NSDate*d2=[datedateFromString:dateString2];
NSTimeIntervallate2=[d2timeIntervalSince1970]*1;
NSTimeIntervalcha=late2-late1;
NSString*timeString=@"";
NSString*house=@"";
NSString*min=@"";
NSString*sen=@"";
sen = [NSStringstringWithFormat:@"%d", (int)cha%60];
//min = [min substringToIndex:min.length-7];
//秒
sen=[NSStringstringWithFormat:@"%@", sen];
min = [NSStringstringWithFormat:@"%d", (int)cha/60%60];
//min = [min substringToIndex:min.length-7];
//分
min=[NSStringstringWithFormat:@"%@", min];
//小时
house = [NSStringstringWithFormat:@"%d", (int)cha/3600/24];
//house = [house substringToIndex:house.length-7];
house=[NSStringstringWithFormat:@"%@", house];
timeString=[NSStringstringWithFormat:@"%@",house];
returntimeString;
}
网友评论