我如何解决我得到的问题2011-07-21 15:55:01 +0000,但时间关闭了4小时,我如何删除+0000?我希望格式为Eg。 2011年6月12日星期五下午1:30
-(IBAction)addButton:(id)sender
{
NSDate *choice = [datepick date];
NSString *words = [[NSString alloc]initWithFormat:@"%@", choice];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Date Chosen
message:words
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
[words release];
label.text = words;
textfield.text = words;
}
- (void)viewDidLoad
{
NSDate *now = [[NSDate alloc] init];
[datepick setDate:now animated:YES];
[now release];
datepick.minimumDate = [NSDate date];
[super viewDidLoad];
}
答案 0 :(得分:1)
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"EEEE dd MMMM yyyy h:mm a"];
NSString *words = [formatter stringFromDate:choise];
Here日期格式化指南。