iOS时间戳
来源:互联网 发布:52mac网可靠吗 编辑:程序博客网 时间:2024/05/18 13:10
NSTimeInterval interval = [[NSDate date] timeIntervalSince1970] * 1000; NSDate *senddate = [NSDatedate]; NSLog(@"date1时间戳 = %ld",time(NULL)); NSString *date2 = [NSStringstringWithFormat:@"%ld", (long)[senddatetimeIntervalSince1970]]; NSLog(@"date2时间戳 = %@",date2); NSDateFormatter *dateformatter = [[NSDateFormatteralloc] init]; [dateformatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; NSString *date1 = [dateformatter stringFromDate:senddate]; NSLog(@"获取当前时间 = %@",date1); // 时间戳转时间 NSDate *confromTimesp = [NSDatedateWithTimeIntervalSince1970:[senddate timeIntervalSince1970]]; NSString *confromTimespStr = [dateformatterstringFromDate:confromTimesp]; NSLog(@"时间戳转时间 = %@",confromTimespStr); // 两个时间戳的间隔 返回的是秒 NSTimeInterval time = [now timeIntervalSinceDate:oldDate]; NSLog(@"time:%f",time/60/60/24);
阅读全文
0 0
- IOS-时间戳转化时间
- iOS-时间戳转时间
- iOS 时间戳
- ios 时间戳
- IOS 时间戳
- IOS 时间戳
- iOS NSDate 时间戳
- iOS 时间戳
- ios 时间戳
- [iOS-GQiang]时间戳
- IOS 时间戳
- iOS 时间戳
- iOS --时间戳
- iOS 时间戳
- iOS 时间戳 详解
- iOS获取时间戳
- iOS --时间戳相关
- iOS C时间戳
- LintCode 解题记录17.8.19 字符串处理6
- (已解决)雷柏v500在Ubuntu系统下键位映射错误
- 【cas】sso和cas概述
- 常见的动态规划问题分析与求解
- 个人随笔和笔记:响应式布局meta声明
- iOS时间戳
- map reduce lambda 区别 用法 结合使用
- C++资源
- 浅析逆元&逆元的蛋用(完全版)
- centos下通过终端查找存储指令的文件名
- 测试小白应该会的MySQL操作
- Linux下Rsync+Inotify-tools实现数据实时同步
- 聚合数据手机验证码在ThinkPHP中实现
- 响应式布局个人随笔