首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在iphone中给出正确的输入日期格式?

如何在iphone中给出正确的输入日期格式?
EN

Stack Overflow用户
提问于 2010-09-09 20:34:43
回答 1查看 310关注 0票数 0

我不想给出正确的输入日期格式,所以请给我正确的输入日期格式。

下面是我的示例代码和日期格式。

代码语言:javascript
复制
        NSString *yourXMLDate = @"Thursday, September 9, 2010";

       NSDateFormatter *inputFormatter = [[NSDateFormatter alloc] init];

       [inputFormatter setDateFormat:@"EEEE, MMMM dd, YYYY"]; // It doesnt work

  ---->[inputFormatter setDateFormat:@"EEEE, ????????????"];

        NSDate *inputDate = [inputFormatter dateFromString:yourXMLDate];

      NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];

       [outputFormatter setDateFormat:@"MM/dd"];

      NSString *outputDate = [outputFormatter stringFromDate:inputDate];

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-09-09 20:49:26

您可以在此处获取日期格式化程序

http://www.stepcase.com/blog/2008/12/02/format-string-for-the-iphone-nsdateformatter/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3676545

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档