问题
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