好的,直截了当,我想制作像这样的日历格式
YYYY年MM月DD日
我设置了这样的代码
- (void)RecentStartDidSelect:(NSDate *)selectedDate element:(id)element {
self.selectedDate = selectedDate;
//////
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:[[NSLocale preferredLanguages] objectAtIndex:0]] autorelease]];
[dateFormat setDateFormat:@"YYYY(EEE)-MM(EEEm)-dd(EEE)"];
NSString *theDate = [dateFormat stringFromDate:self.selectedDate];
//may have originated from textField or barButtonItem, use an IBOutlet instead of element
Recent_start.text = theDate;
[Recent_start resignFirstResponder];
}
,输出
theDate-->2013(Wed)-02(Wed48)-06(Wed)
我现在迷路了,如何创建这样的日期格式? :((请帮助
答案 0 :(得分:3)
[dateFormatter setDateFormat:@"yyyy年MM月dd日"];
那是中国人