NSDateFormatter在模拟器中显示错误的日期格式(用nachm代替PM) [英] NSDateFormatter is showing wrong date format (nachm. instead of PM) in the simulator

查看:61
本文介绍了NSDateFormatter在模拟器中显示错误的日期格式(用nachm代替PM)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么模拟器向我显示 10:30 nachm。而不是 10:30 PM ?我使用以下代码:

Why does the simulator is showing me 10:30 nachm. instead of 10:30 PM? I use the following code:

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat: @"h:mm a"];
NSLog(@"%@",[dateformat stringFromDate: myDate]);

好的,我想我必须在某个地方设置区域设置...

OK I think I have to set a Locale somewhere ...

推荐答案

我认为您的模拟器中的语言设置为德语。比nachm。表示Nachmittags。那等于PM。看一下模拟器中的设置。 ;-)

I think the language in your simulator is set to German. Than nachm. means Nachmittags. And that's equal to PM. Take a look at the settings in the simulator. ;-)

这篇关于NSDateFormatter在模拟器中显示错误的日期格式(用nachm代替PM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆