tempDateString という文字列パラメーターを介して [日 月 年] 形式で日付を受け取ります (例: 01 05 2005):
NSLog(@"tempdatestring %@", tempDateString);
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd MM YYYY"];
NSDate *dayDate = [dateFormatter dateFromString:tempDateString];
NSLog(@"daydate %@", dayDate);
私の問題は、2 つのログが一致しないことです。出力は次のとおりです。
tempdatestring 04 10 2012
daydate 2011-12-24 22:00:00 +0000
適切な日付を取得するには、日付フォーマッタの日付形式で何を変更する必要がありますか?