转换前2009-12-31T00:00:00.0000000-05:00格式转换为NSDate [英] Converting ex. 2009-12-31T00:00:00.0000000-05:00 format to NSDate

查看:60
本文介绍了转换前2009-12-31T00:00:00.0000000-05:00格式转换为NSDate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过iPhone应用程序从Web服务获取数据并以2009-12-31T00:00:00.0000000-05:00的格式获取日期.如何将其转换为NSDate ..请帮助....

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

推荐答案

此格式的问题是 NSDateFormatter 日期不支持 -05:00 格式格式.

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

Unicode日期格式模式表示它支持 -0500.您可能需要手动将冒号移出时区,然后使用 yyyy-MM-dd'T'HH:mm:ss.0000000ZZZ 格式(或也许是 yyyy-MM-dd'T'HH:mm:ss.SSSZZZ )

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)

这篇关于转换前2009-12-31T00:00:00.0000000-05:00格式转换为NSDate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆