NSDateFormatter is showing wrong date format (nach

2019-09-06 11:35发布

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条回答
仙女界的扛把子
2楼-- · 2019-09-06 11:44

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

查看更多
登录 后发表回答