iOS系统日历选择问题

参考:https://blog.csdn.net/lg_sun/article/details/78913064

-(NSString *)getTimeToken{
    NSDateFormatter *dateformatter = [NSDateFormatter new];
    dateformatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
    
    //统一转公历
    NSLocale *local = [[NSLocale alloc]initWithLocaleIdentifier:NSLocale.preferredLanguages[0]];
    dateformatter.locale = local;
    
    return [dateformatter stringFromDate:[NSDate date]];
}

   如果没有统一转公历 打印是这样:
    NSLog(@"---当前时间--->%@",[self getTimeToken]);
    //公历    ---当前时间--->2018-04-17 10:03:52
    //日本日历 ---当前时间--->0030-04-17 10:04:27
    //佛教日历 ---当前时间--->2561-04-17 10:04:51
    

 

posted @ 2018-04-17 10:12  liuw_flexi  阅读(518)  评论(0编辑  收藏  举报