NSDateFormatter 在模拟器中显示错误的日期格式(nachm.而不是 PM)

发布于 2024-09-19 09:41:23 字数 289 浏览 6 评论 0原文

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

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

好的,我想我必须在某处设置一个区域设置......

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋风の叶未落 2024-09-26 09:41:23

我认为您的模拟器中的语言设置为德语。比纳赫姆。意思是“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. ;-)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文