Objective-C 中的日期解析
如何最有效地将其解析为 Objective-C NSDate?
“2010-07-13T11:22:33-07:00”
这是我尝试过
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MMM-dd'T'HH:mm:ssZ"];
但没有成功
How can I parse this into an objective-c NSDate most efficiently?
"2010-07-13T11:22:33-07:00"
This is what I tried
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"yyyy-MMM-dd'T'HH:mm:ssZ"];
but did not work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这里,我遇到了这个问题
“我的格式如果我将“+00:00”更改为“+0000”,那么我可以在格式中使用“Z”,如果我将其更改为“GMT+00:00”。 “然后我可以使用 ZZZZ 正确获取数据。似乎已经删除了一些东西来处理这种混合,因为它之前在 OS 3.x 上为我工作”
have a look here, i had that issue
"The format that I am being given is halfway between RFC 822 and GMT. if i change the "+00:00" to "+0000" then I can use the "Z" on my format. and if i change it to "GMT+00:00" then I can use ZZZZ to get the data properly. It seems that something has been stripped out to handle this hybrid as it was working for me before with OS 3.x"