//写个字符串分类
- (NSString *)dateTimeDifferenceWithStartTimeEndTime
{
NSDateFormatter *date = [[NSDateFormatter alloc]init];
[date setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *startD =[date dateFromString:self];
NSDate* dat = [NSDate date];
NSTimeInterval start = [startD timeIntervalSince1970]*1;
NSTimeInterval end=[dat timeIntervalSince1970]*1;
NSTimeInterval value = end - start;
int second = (int)value %60;//秒
int minute = (int)value /60%60;
int house = (int)value / (3600)%24;
int day = (int)value / (24 * 3600);
NSString *str;
if (day != 0) {
str = [NSString stringWithFormat:@"%d天%d小时%d分%d秒",day,house,minute,second];
}else if (day==0 && house != 0) {
str = [NSString stringWithFormat:@"%d小时%d分%d秒",house,minute,second];
}else if (day== 0 && house== 0 && minute!=0) {
str = [NSString stringWithFormat:@"%d分%d秒",minute,second];
}else{
str = [NSString stringWithFormat:@"%d秒",second];
}
return str;
}