当前位置: 首页 > news >正文

西安网站建设公司排行榜学生制作网站建设 维护

西安网站建设公司排行榜,学生制作网站建设 维护,微信公众官网登录入口,泉州企业免费建站1、NSDate 时间与日期的初始化,主要有 [NSDate date]; 2、NSDateFormatter 主要用于NSString和Date之间相互转化//NSDate转NSStringstringFromDate:dt//NSString转NSDatedateFromString 3、NSCalendar和NSDateComponents Date打印出具体时间的年月日和把年月日转化为Date4、N…1、NSDate 时间与日期的初始化,主要有 [NSDate date]; 2、NSDateFormatter 主要用于NSString和Date之间相互转化//NSDate转NSStringstringFromDate:dt//NSString转NSDatedateFromString 3、NSCalendar和NSDateComponents Date打印出具体时间的年月日和把年月日转化为Date4、NSTimer 定时器(NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo;(NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo; (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullable id)userInfo repeats:(BOOL)yesOrNo;(NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(nullable id)userInfo repeats:(BOOL)yesOrNo; 5、测试Demo main.m文件 int main(int argc, char * argv[]) {autoreleasepool {//NSDate常用方法NSDate *date [NSDate date];NSLog(%, date);NSDate *date1 [[NSDate alloc] initWithTimeIntervalSinceNow:3600 * 24];NSLog(date1 is %, date1);NSDate *date2 [[NSDate alloc] initWithTimeIntervalSinceNow:-3 * 3600 * 24];NSLog(date1 is %, date2);NSLocale *cn [NSLocale currentLocale];NSLog(%, [date1 descriptionWithLocale:cn]);NSLog(%, [date1 earlierDate:date2]);//NSDate转NSStringNSDate *dt [NSDate dateWithTimeIntervalSince1970:3600 * 24 * 366 * 20];NSDate *dt1 [NSDate dateWithTimeIntervalSince1970:0];NSLog(%, dt1);NSDateFormatter *df [[NSDateFormatter alloc] init];[df setDateFormat:公元yyyy年MM月DD日 HH时mm分];NSLog(%, [df stringFromDate:dt]);//NSString转NSDateNSString *str 2018-03-02;NSDateFormatter *df1 [[NSDateFormatter alloc] init];[df1 setDateFormat:yyyy-MM-dd];NSLog(%, [df1 dateFromString:str]);//NSCalendar和NSDateComponents使用NSCalendar *car [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];NSDate *date3 [NSDate date];unsigned unit NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit | NSWeekdayCalendarUnit;NSDateComponents *comp [car components:unit fromDate:date3];NSLog(现在是%ld年, comp.year);NSLog(现在是%ld月, comp.month);NSLog(现在是%ld日, comp.day);NSLog(现在是%ld时, comp.hour);NSLog(现在是%ld分, comp.minute);NSLog(现在是%ld秒, comp.second);NSLog(现在是星期%ld, comp.weekday);NSDateComponents *comp1 [[NSDateComponents alloc] init];comp1.year 2015;comp1.month 4;comp1.day 5;comp1.hour 18;comp1.minute 34;NSDate *date4 [car dateFromComponents:comp1];NSLog(date is %:, date4);return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));} } ViewControl.m文件(这里实现的定时器) implementation ViewController- (void)viewDidLoad {[super viewDidLoad]; // Control *control [Control new]; // control.delegate self; // [control willShowAlert];NSTimer* timer [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:selector(Timered:) userInfo:nil repeats:YES]; }- (void)Timered:(NSTimer*)timer {NSLog(hello chenyu); } end 6、运行的结果 2018-07-12 23:03:31.6348700800 cyTest[37918:6787840] hello chenyu 2018-07-12 23:03:32.6349150800 cyTest[37918:6787840] hello chenyu 2018-07-12 23:03:33.6348810800 cyTest[37918:6787840] hello chenyu 2018-07-12 23:03:34.6349380800 cyTest[37918:6787840] hello chenyu 2018-07-12 23:03:35.6349980800 cyTest[37918:6787840] hello chenyu 2018-07-12 23:03:36.6350950800 cyTest[37918:6787840] hello chenyu 2018-07-12 23:03:37.6350860800 cyTest[37918:6787840] hello chenyu2018-07-12 23:14:23.7896400800 cyTest[38218:6796894] Thu Jul 12 23:14:23 2018 2018-07-12 23:14:23.7908440800 cyTest[38218:6796894] date1 is Fri Jul 13 23:14:23 2018 2018-07-12 23:14:23.7914920800 cyTest[38218:6796894] date1 is Mon Jul 9 23:14:23 2018 2018-07-12 23:14:23.8045980800 cyTest[38218:6796894] Friday, July 13, 2018 at 11:14:23 PM China Standard Time 2018-07-12 23:14:23.8048530800 cyTest[38218:6796894] Mon Jul 9 23:14:23 2018 2018-07-12 23:14:23.8053460800 cyTest[38218:6796894] Thu Jan 1 08:00:00 1970 2018-07-12 23:14:23.8059270800 cyTest[38218:6796894] 公元1990年01月16日 08时00分 2018-07-12 23:14:23.8083300800 cyTest[38218:6796894] Fri Mar 2 00:00:00 2018 2018-07-12 23:14:23.8089820800 cyTest[38218:6796894] 现在是2018年 2018-07-12 23:14:23.8091500800 cyTest[38218:6796894] 现在是7月 2018-07-12 23:14:23.8093540800 cyTest[38218:6796894] 现在是12日 2018-07-12 23:14:23.8095580800 cyTest[38218:6796894] 现在是23时 2018-07-12 23:14:23.8096840800 cyTest[38218:6796894] 现在是14分 2018-07-12 23:14:23.8098340800 cyTest[38218:6796894] 现在是23秒 2018-07-12 23:14:23.8104070800 cyTest[38218:6796894] 现在是星期5 2018-07-12 23:14:23.8112110800 cyTest[38218:6796894] date is Sun Apr 5 18:34:00 2015: 2018-07-12 23:14:27.7646330800 cyTest[38218:6796894] hello chenyu 2018-07-12 23:14:28.7647580800 cyTest[38218:6796894] hello chenyu 2018-07-12 23:14:29.7657760800 cyTest[38218:6796894] hello chenyu 2018-07-12 23:14:30.7657920800 cyTest[38218:6796894] hello chenyu 2018-07-12 23:14:31.7654260800 cyTest[38218:6796894] hello chenyu
http://www.zqtcl.cn/news/272697/

相关文章:

  • flash网站代做马鞍山网站建设制作公司
  • 温州网站的优化wordpress 注册邮箱验证失败
  • php网站开发实例视频教程宁波seo运营推广平台排名
  • 网络营销网站开发设计公司网站推广营销
  • 2015年做那个网站致富wordpress最新模板
  • 做网站开发平台北京广告公司有哪些
  • 郑州企业建站系统模板兰州需要做网站的公司有哪些
  • 怎样做网站卖东西 自己有货句容网络公司
  • 网站建设协议书 保密条款免费发布推广的网站
  • 网站首页外链上海网站建设联系方式
  • 陕西网站建设优化技术2023年1月热点新闻事件
  • 广东省建设银行招聘网站免费搭建个人网站
  • 知名商城网站建设公司wordpress主题 汉化
  • 网站上线做什么pc网站如何做移动适配
  • wap网站搭建北京北京网站建设
  • 放心的网站设计制作免费做logo设计的网站
  • 温州专业手机网站制作多少钱移动商城 网站建设方法方式
  • 周口网站开发wordpress
  • 如何查网站的备案号玉环在哪里做网站
  • 网站开发什么叫前端后端seo研究中心晴天
  • 邢台建筑类的建设网站代刷网站只做软件下载
  • 关于旅游的网站建设目的食品网站建设的目的
  • 开发php网站开发太湖网站建设推荐秒搜科技
  • 90设计网站怎么绑定手机号淘宝搜索排名
  • 无锡自助做网站哪些编程语言适合网站开发
  • 蒲城网站建设wzjseo北京专业推广公司
  • 阳春做网站外贸建站推广公司
  • 哪个网站的课件做的好源码之家关闭了
  • 各大网站热搜榜排名嵊州网站
  • 在哪找做网站的镇江网页设计工作室