NSDateFormatter,dateFromString 返回 nil
添加此代码
NSDateFormatter *df = [[NSDateFormatter alloc]init];
NSString *entry = @"March 28, 2012";
[df setDateFormat:@"yyyy-MM-dd"];
NSDate *date = [df dateFromString:entry];
日期返回零值。我对输入日期字符串有疑问。是否可以将其转换为日期?
Added this code
NSDateFormatter *df = [[NSDateFormatter alloc]init];
NSString *entry = @"March 28, 2012";
[df setDateFormat:@"yyyy-MM-dd"];
NSDate *date = [df dateFromString:entry];
The date returns nil value. I have doubt about the entry date string.Is it possible to convert this into date?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
格式错误。请按如下操作。
编辑
The format is wrong. Please do as following.
Edit
您的日期格式字符串和日期值字符串不匹配。
要么
或
Your date format string and date value string does not match.
Either
OR