```
//计算两个时间戳的时间差
+ (NSString*)compareTwoTime:(longlong)time1 time2:(longlong)time2
{
NSTimeIntervalbalance = time2 /1000- time1 /1000;
NSString*timeString = [[NSStringalloc]init];
timeString = [NSStringstringWithFormat:@"%f",balance /60];
timeString = [timeStringsubstringToIndex:timeString.length-7];
NSIntegertimeInt = [timeStringintValue];
NSIntegerhour = timeInt /60;
NSIntegermint = timeInt %60;
if(hour ==0) {
timeString = [NSStringstringWithFormat:@"%ld分钟",(long)mint];
}
else
{
if(mint ==0) {
timeString = [NSStringstringWithFormat:@"%ld小时",(long)hour];
}
else
{
timeString = [NSStringstringWithFormat:@"%ld小时%ld分钟",(long)hour,(long)mint];
}
}
returntimeString;
}
@end
```
网友评论