在开发过程中,经常要做本地适配,同样时间的显示格式也需要本地化,本地化之前需要获取设置中的多语言环境中的区域语言格式示例,网上搜了一下,基本上没找到啊,看来国人的分享意识不强,现在我贴出了相关代码,方便大家使用。
NSDateFormatter*date=[[NSDateFormatter alloc] init];
[date setDateStyle:NSDateFormatterMediumStyle];
[date setTimeStyle:NSDateFormatterMediumStyle];
NSLog(@"current date is %@",[date stringFromDate:[NSDate date]]);