zoukankan      html  css  js  c++  java
  • 一来一回,

    4.4、通过NSCALENDAR类来创建日期 

            NSDateComponents *comp = [[NSDateComponents alloc]init]; 

            [comp setMonth:06]; 

            [comp setDay:01]; 

            [comp setYear:2001]; 

            NSCalendar *myCal = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; 

            NSDate *myDate1 = [myCal dateFromComponents:comp]; 

            NSLog(@"myDate1 = %@",myDate1); 

     

    4.5、从已有日期获取日期 

            unsigned units  = NSMonthCalendarUnit|NSDayCalendarUnit|NSYearCalendarUnit; 

            NSDateComponents *comp1 = [myCal components:units fromDate:now]; 

            NSInteger month = [comp1 month]; 

            NSInteger year = [comp1 year]; 

            NSInteger day = [comp1 day]; 

  • 相关阅读:
    「codeforces
    「sdoi2019
    「ABC 218」解集
    「hdu
    「atcoder
    「tricks」平凡二分幻术
    并查集
    Bellman-Ford算法 & SPFA & SPFA_DFS
    最近公共祖先(LCA)
    题解 P5751 【[NOI1999]01串】
  • 原文地址:https://www.cnblogs.com/guligei/p/3196018.html
Copyright © 2011-2022 走看看