UIView -> image & 本地时间获取
//UIView 转换为图片
UIGraphicsBeginImageContext(self.rootsView.bounds.size);
[_rootsView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewBeImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return viewBeImage;
//本地时间
NSDate *now = [NSDate date];
NSCalendar *calendar = [NSCalendar currentCalendar];
NSUInteger unitFlags = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
NSDateComponents *dateComponent = [calendar components:unitFlags fromDate:now];
NSInteger year = [dateComponent year];//年
NSInteger month = [dateComponent month];//月
NSInteger day = [dateComponent day];//日
NSInteger hour = [dateComponent hour];//小时
NSInteger minute = [dateComponent minute];//分钟
NSInteger second = [dateComponent second];//秒钟
NSLog(@"year is: %ld", year);
NSLog(@"month is: %ld", month);
NSLog(@"day is: %ld", day);
NSLog(@"hour is: %ld", hour);
NSLog(@"minute is: %ld", minute);
NSLog(@"second is: %ld", second);
UIView -> image & 本地时间获取的更多相关文章
- c/c++本地时间获取
在记录程序日志时,需要记录时间.如下: #include <iostream> #include <time.h> #include <windows.h> usi ...
- php获取时间问题,用默认配置读到本地时间。。。。。
用date获取到时间有8小时时差 因为php用date获取到的是格林威治时区的时间,而大陆时间和格林威治时间有8个小时时差,所以.... 修改:网上有各种修改方式: 比如:在程序中添加时间的初始化的语 ...
- python获取网络时间和本地时间
今天我们来看一下如何用python获取网络时间和本地时间,直接上代码吧,代码中都有注释. python获取网络时间 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...
- C/C++获取本地时间常见方法
跨平台方法 方法一:手动暴力法 #include <iostream> using namespace std; #include <time.h> time_t t = ti ...
- python获取本地时间
python本地时间 import time # 格式化成2016-03-20 11:45:39形式 now = time.strftime("%Y-%m-%d %H:%M:%S" ...
- 根据本地/服务器时间获取指定时区时间 new Date指定时区时间
1.代码 function getTimeByTimeZone(timeZone){ var d=new Date(); localTime = d.getTime(), localOffset=d. ...
- Python: 处理mongodb文档,怎么让UTC时间转换为本地时间?
存储数据到MongoDB数据库时,一般我们会加一个更新数据的时间update_time.这时在python代码中 会用到datetime模块以便获取当前系统时间,但是存入到MongoDB数据库时,存储 ...
- 【C#公共帮助类】DateTimeHelper设置电脑本地时间,实际开发很需要
关于本文档的说明 本文档主要为了解决实际开发当中,服务器和客户端电脑时间不能相等的问题,纯干货,实际项目这种时间不同步的情况很多很多,时间不相等,到时候把本地的数据提交给服务器,服务器看实际上传时间和 ...
- Sql Server 的本地时间和UTC时间
一,本地时间和UTC时间 本地时间 世界的每个地区都有自己的本地时间,整个地球分为二十四时区,每个时区都有自己的本地时间. UTC时间 在国际无线电通信中,为统一而普遍使用一个标准时间,称为通用协调时 ...
随机推荐
- TinyMCE下载及使用
1.TinyMCE下载 官方下载网址:http://www.tinymce.com/ 简体中文语言包下载:http://www.tinymce.com/i18n/index.php?ctrl=lang ...
- logstash 处理各种时间格式
tomcat access日志: { "@version" => "1", "@timestamp" => "2016 ...
- 【转】文件读写NDK(或Linux)
原文网址:http://www.ithao123.cn/content-10709539.html 使用NDK进行文件读写,有利于保存数据的安全性,项目需要,要文件读写从Java中处理搬到Linux平 ...
- 【动态规划】Vijos P1011 清帝之惑之顺治
题目链接: https://vijos.org/p/1011 题目大意: 给一张N*M的地图(N,M<=500),可从任一点开始沿上下左右走,只能走比当前低的地方.问最长能走多少格. 题目思路: ...
- IIS6.0服务器搭建网站无法访问解决方法
IIS6.0服务器搭建网站无法访问解决方法 IIS6.0服务器搭建网站无法访问解决方法很多朋友在用IIS6架网站的时候遇到不少问题,而这些问题有些在过去的IIS5里面就遇到过,有些是新出来的, ...
- cf703C Chris and Road
C. Chris and Road time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...
- 借助github搭建自己的博客
创建GitHub技术博客全攻略 通过GitHub Pages建立个人站点(详细步骤) 备注: 我搭建成功了,但是访问时只能使用"http://username.github.io/usern ...
- php 获取今日、昨日、上周、本月的起始时间戳和结束时间戳的方法
php 获取今日.昨日.上周.本月的起始时间戳和结束时间戳的方法,主要使用到了 php 的时间函数 mktime.下面首先还是直奔主题以示例说明如何使用 mktime 获取今日.昨日.上周.本月的起始 ...
- 10382 - Watering Grass
Problem E Watering Grass Input: standard input Output: standard output Time Limit: 3 seconds n sprin ...
- PostgreSQL和GreenPlum数据库的区别
PostgreSQL PostgreSQL是以加州大学伯克利分校计算机系开发的 POSTGRES,现在已经更名为POSTGRES,版本 4.2为基础的对象关系型数据库管理系统(ORDBMS).Po ...