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时间 在国际无线电通信中,为统一而普遍使用一个标准时间,称为通用协调时 ...
随机推荐
- Sequence《优先队列》
Description Given m sequences, each contains n non-negative integer. Now we may select one number fr ...
- IOS中UIButton和UIImageView的区别
1.使用场合 UIImageView:如果仅仅是为了显示图片,不需要监听图片的点击事件 UIButton:既要显示图片,又要监听图片等点击事件 2.相同点 都能显示图片 3.不同点 UIButton能 ...
- UpdateLayeredWindow, Layered Windows, codeproject
http://www.codeproject.com/Articles/16362/Bring-your-frame-window-a-shadow http://www.codeproject.co ...
- network: Android 网络判断(wifi、3G与其他)
package mark.zeng; import Java.util.List; import Android.content.Context; import android.location.Lo ...
- Arrays.sort的粗略讲解
排序算法,基本的高级语言都有一些提供.C语言有qsort()函数,C++有sort()函数,java语言有Arrays类(不是Array).用这些排序时,都可以写自己的排序规则. Java API对A ...
- 《STL源码剖析》环境配置
首先,去侯捷网站下载相关文档:http://jjhou.boolan.com/jjwbooks-tass.htm. 这本书采用的是Cygnus C++ 2.91 for windows.下载地址:ht ...
- MySQL默认INFORMATION_SCHEMA,MySQL,TEST三个数据库用途
本文简要说明了MySQL数据库安装好后自带的INFORMATION_SCHEMA,MySQL,TEST三个数据库的用途. 第一个数据库INFORMATION_SCHEMA:提供了访问数据库元数据的方式 ...
- c++实现委托
#include "stdafx.h" #include <iostream> #include <string> using namespace std; ...
- CentOS 6.3上搭建PPTP VPN
系统版本:CentOS 6.3_x86_64 eth0:172.16.10.72(实验环境当公网IP使用) eth1:192.168.100.50 1.检测是否支持ppp模块 # cat /dev/p ...
- Android *.db-journal
config.xml <!-- The default journal mode to use use when Write-Ahead Logging is not active. Choic ...