NSDateFormatter fails to return a datetime for UK region with 12 hour clock set [duplicate]

筅森魡賤 提交于 2019-12-06 01:37:47

You are parsing a RFC 3339/ISO 8601 date. As such, you should set the locale of the formatter to be en_US_POSIX.

theDateFormatter.locale = [NSLocale localeWithLocaleIdentifier:@"en_US_POSIX"];

See Apple Technical Q&A 1480.

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