NSDateFormatter is showing wrong date format (nachm. instead of PM) in the simulator

断了今生、忘了曾经 提交于 2019-12-12 01:33:51

问题


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 ...


回答1:


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. ;-)



来源:https://stackoverflow.com/questions/3726491/nsdateformatter-is-showing-wrong-date-format-nachm-instead-of-pm-in-the-simul

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!