使用 DateTime 格式的 JSON 进行 POST
我在如何格式化 NSDate 以将其作为 JSON 发布到 REST 服务 .net 上遇到了很多困难。接受的格式是:
"Date":"\/Date(459842400000+0200)\/"
我对响应没有问题并将其解析为 NSDate。我使用 JSONFramework 进行解析。
有什么建议吗?
Im struggling a lot with how I can format a NSDate to POST it as JSON to REST service .net. The accepted format is:
"Date":"\/Date(459842400000+0200)\/"
I have no problem with the response and to parse it to NSDate. I use JSONFramework for parsing.
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看一下 NSDateFormatter 和 NSDate 类。
从您的示例来看,您似乎想要使用
Date(Timestamp + TimeZone)
构建一个字符串。有两种方法可以做到这一点,timeIntervalSince1970
(NSDate
) 和timeZone
(NSDateFormatter)。Take a look at the NSDateFormatter and NSDate classes.
From your example it looks like you want to build a string with
Date(Timestamp + TimeZone)
. There are two methods that do that,timeIntervalSince1970
(NSDate
) andtimeZone
(NSDateFormatter).