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/
精彩评论