2010-09-09 115 views
0

我不會給出正確的日期格式的輸入日期,所以請給我正確的輸入日期格式。如何在iphone中輸入正確的輸入日期格式?

這裏我的示例代碼和日期格式。

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

謝謝!

回答