如何从@“2011-11-22 03:20:39”获取 NSString 日期部分?
我有 NSString *dateAndTime = @"2011-11-22 03:20:39"。
我想从上面的字符串中获取 NSString *dateWithoutTime (例如“2011-11-22”)。
我怎样才能得到?
Possible Duplicate:
NSString to NSDate
How to parse a date string into an NSDate object in iOS
I have NSString *dateAndTime = @"2011-11-22 03:20:39".
I want to get a NSString *dateWithoutTime (e.g. "2011-11-22") from this above string.
How do I get?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
用这个
Use this
您可以通过以下方式获取相应的
NSDate
但这已经被回答了很多次了。在提出新问题之前先搜索以前的帖子。
You can get the corresponding
NSDate
byBut this has been answered so many times. Search the previous posts before asking a new question.