iOS中获取系统时间
来源:互联网 发布:刘慈欣光荣与梦想知乎 编辑:程序博客网 时间:2024/05/19 23:28
NSDate * date = [NSDate date]; NSTimeInterval sec = [date timeIntervalSinceNow]; NSDate * currentDate = [[NSDate alloc] initWithTimeIntervalSinc eNow :sec];//设置时间输出格式: NSDateFormatter * df = [[NSDateFormatter alloc] init ]; setDateFormat:@"yyyy年MM月dd日 HH小时mm分ss秒"]; [df NSString * na = [df stringFromDate:currentDate]; NSLog(@"系统当前时间为:%@",na);
//获得系统日期NSCalendar * cal=[NSCalendar currentCalendar]; NSUInteger unitFlags=NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit; NSDateComponents * conponent= [cal components:unitFlags fromDate:senddate]; NSInteger year=[conponent year]; NSInteger month=[conponent month]; NSInteger day=[conponent day]; NSString * nsDateString= [NSString stringWithFormat:@"%4d年%2d月%2d日",year,month,day];NSLog(@"系统当前日期为:%@",nsDateString);
0 0
- iOS中获取系统时间
- ios获取系统时间
- 获取系统时间ios
- ios获取系统时间
- iOS获取系统时间
- iOS 获取系统时间
- IOS 获取系统时间
- ios开发 获取系统时间
- ios 获取系统当前时间
- ios 获取当前系统时间
- iOS 获取手机系统时间
- iOS获取系统当前时间
- iOS 获取系统当前时间
- IOS 获取系统的时间
- iOS获取系统时间、日期
- iOS 获取系统当前时间
- ios开发 获取系统时间
- iOS 获取系统日期时间
- grep、find 命令
- TabHost 子Tab项的点击事件
- HDU 4815 Little Tiger vs. Deep Monkey (DP)2013 长春现场赛
- 网上文章常见的几种读取.properties文件的方式
- window 查看端口占用进程 并杀死
- iOS中获取系统时间
- 移动聚合广告哪家强,芒果?Keymob?Adview?
- 你会做Web上的用户登录功能吗?
- Android应用开发性能优化完全分析
- CodeForces Two Sets(并查集)
- 设置eclipse的debug提醒
- tomcatec出错-Web app root system property already set to different value
- 晶格振动
- [LeetCode-82] Remove Duplicates from Sorted List II