//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 & 本地时间获取的更多相关文章

  1. c/c++本地时间获取

    在记录程序日志时,需要记录时间.如下: #include <iostream> #include <time.h> #include <windows.h> usi ...

  2. php获取时间问题,用默认配置读到本地时间。。。。。

    用date获取到时间有8小时时差 因为php用date获取到的是格林威治时区的时间,而大陆时间和格林威治时间有8个小时时差,所以.... 修改:网上有各种修改方式: 比如:在程序中添加时间的初始化的语 ...

  3. python获取网络时间和本地时间

    今天我们来看一下如何用python获取网络时间和本地时间,直接上代码吧,代码中都有注释. python获取网络时间 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...

  4. C/C++获取本地时间常见方法

    跨平台方法 方法一:手动暴力法 #include <iostream> using namespace std; #include <time.h> time_t t = ti ...

  5. python获取本地时间

    python本地时间 import time # 格式化成2016-03-20 11:45:39形式 now = time.strftime("%Y-%m-%d %H:%M:%S" ...

  6. 根据本地/服务器时间获取指定时区时间 new Date指定时区时间

    1.代码 function getTimeByTimeZone(timeZone){ var d=new Date(); localTime = d.getTime(), localOffset=d. ...

  7. Python: 处理mongodb文档,怎么让UTC时间转换为本地时间?

    存储数据到MongoDB数据库时,一般我们会加一个更新数据的时间update_time.这时在python代码中 会用到datetime模块以便获取当前系统时间,但是存入到MongoDB数据库时,存储 ...

  8. 【C#公共帮助类】DateTimeHelper设置电脑本地时间,实际开发很需要

    关于本文档的说明 本文档主要为了解决实际开发当中,服务器和客户端电脑时间不能相等的问题,纯干货,实际项目这种时间不同步的情况很多很多,时间不相等,到时候把本地的数据提交给服务器,服务器看实际上传时间和 ...

  9. Sql Server 的本地时间和UTC时间

    一,本地时间和UTC时间 本地时间 世界的每个地区都有自己的本地时间,整个地球分为二十四时区,每个时区都有自己的本地时间. UTC时间 在国际无线电通信中,为统一而普遍使用一个标准时间,称为通用协调时 ...

随机推荐

  1. Sequence《优先队列》

    Description Given m sequences, each contains n non-negative integer. Now we may select one number fr ...

  2. IOS中UIButton和UIImageView的区别

    1.使用场合 UIImageView:如果仅仅是为了显示图片,不需要监听图片的点击事件 UIButton:既要显示图片,又要监听图片等点击事件 2.相同点 都能显示图片 3.不同点 UIButton能 ...

  3. UpdateLayeredWindow, Layered Windows, codeproject

    http://www.codeproject.com/Articles/16362/Bring-your-frame-window-a-shadow http://www.codeproject.co ...

  4. network: Android 网络判断(wifi、3G与其他)

    package mark.zeng; import Java.util.List; import Android.content.Context; import android.location.Lo ...

  5. Arrays.sort的粗略讲解

    排序算法,基本的高级语言都有一些提供.C语言有qsort()函数,C++有sort()函数,java语言有Arrays类(不是Array).用这些排序时,都可以写自己的排序规则. Java API对A ...

  6. 《STL源码剖析》环境配置

    首先,去侯捷网站下载相关文档:http://jjhou.boolan.com/jjwbooks-tass.htm. 这本书采用的是Cygnus C++ 2.91 for windows.下载地址:ht ...

  7. MySQL默认INFORMATION_SCHEMA,MySQL,TEST三个数据库用途

    本文简要说明了MySQL数据库安装好后自带的INFORMATION_SCHEMA,MySQL,TEST三个数据库的用途. 第一个数据库INFORMATION_SCHEMA:提供了访问数据库元数据的方式 ...

  8. c++实现委托

    #include "stdafx.h" #include <iostream> #include <string> using namespace std; ...

  9. 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 ...

  10. Android *.db-journal

    config.xml <!-- The default journal mode to use use when Write-Ahead Logging is not active. Choic ...