iOS 比较两个时间差
来源:互联网 发布:传奇霸业硬件数据 编辑:程序博客网 时间:2024/06/06 12:47
- (NSString *)intervalFromLastDate: (NSString *) dateString1 toTheDate:(NSString *) dateString2
{
NSArray *timeArray1=[dateString1componentsSeparatedByString:@"."];
dateString1=[timeArray1 objectAtIndex:0];
NSArray *timeArray2=[dateString2componentsSeparatedByString:@"."];
dateString2=[timeArray2 objectAtIndex:0];
NSLog(@"%@.....%@",dateString1,dateString2);
NSDateFormatter *date=[[NSDateFormatteralloc] init];
[date setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
NSDate *d1=[datedateFromString:dateString1];
NSTimeInterval late1=[d1timeIntervalSince1970]*1;
NSDate *d2=[datedateFromString:dateString2];
NSTimeInterval late2=[d2timeIntervalSince1970]*1;
NSTimeInterval cha=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];
// house = [house substringToIndex:house.length-7];
house=[NSStringstringWithFormat:@"%@", house];
timeString=[NSStringstringWithFormat:@"%@:%@:%@",house,min,sen];
// return timeString;
return [NSStringstringWithFormat:@"%f",cha];
}
- iOS 比较两个时间差
- 比较两个日期时间差
- IOS 判断两个时间差
- IOS算两个时间差
- C#中比较两个时间的时间差
- 比较两个时间的大小和时间差
- 比较两个时间的大小和时间差
- Android 比较两个时间的时间差
- iOS 计算两个时间的时间差
- iOS开发---计算两个日期的时间差
- IOS 计算两个时区之间的时间差
- ios 计算两个时间之间的时间差
- iOS计算两个时间的时间差
- postgresql 比较两个时间差大于 N个小时
- iOS开发---判断两个日期的时间差2
- 两个日期时间差
- 两个日期,获取时间差
- 求两个时间差
- java的switch表达式支持的类型
- jQuery Ajax 实例 ($.ajax、$.post、$.get)
- 生成对抗网络
- 微信支付接入流程——刷卡支付接入
- 波浪控件
- iOS 比较两个时间差
- STM32内部flash读写
- C/C++ struct/class/union内存对齐
- android apk下载完成后调用安装
- 20170621安装sync
- 大型网站技术架构
- day24
- 关于反射的面试题
- web项目中镶嵌player