Converting ex. 2009-12-31T00:00:00.0000000-05:00 format to NSDate

做~自己de王妃 提交于 2019-12-25 03:12:45

问题


I am working with getting data from webservice in iPhone app and getting a date in format 2009-12-31T00:00:00.0000000-05:00.. How can I convert this to NSDate.. Please help....


回答1:


The problem with this format is that the -05:00 format is not supported by NSDateFormatter date formats.

Unicode date format patterns says it supports -0500 though. You may have to manually strip the colon out of the timezone and then parse it using the format yyyy-MM-dd'T'HH:mm:ss.0000000ZZZ (or maybe yyyy-MM-dd'T'HH:mm:ss.SSSZZZ)




回答2:


Please follow this link and try taking your date in string format...the convert it to NSDate



来源:https://stackoverflow.com/questions/4757797/converting-ex-2009-12-31t000000-0000000-0500-format-to-nsdate

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