开发者

How to give correct input date format in iphone?

I donno to give the correct date format of the input date, so please give me to correct input date format.

Here my sample code and the date formats.

        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];

Thanks!


You can get the date formatters here

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜