系统语言
NSString *udfLanguageCode = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"][0];
NSString *pfLanguageCode = [NSLocale preferredLanguages][0];
NSString *localeLanguageCode = [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode];
系统时间
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; // 设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
NSDate *datenow = [NSDate date];
NSString *nowtimeStr = [formatter stringFromDate:datenow];//将nsdate按formatter格式转成nsstring
NSLog(@"nowtimeStr = %@",nowtimeStr);
网友评论