我需要知道如何像示例4-5-2011这样获得日期d-m-y,特别是没有分钟,小时和+0000

代码 :

CGRect pickerFrame = CGRectMake(0, 40, 0, 0);

UIDatePicker *pickerVieww = [[UIDatePicker alloc] initWithFrame:pickerFrame];

    pickerVieww.timeZone = [NSTimeZone defaultTimeZone];
    pickerVieww.datePickerMode= UIDatePickerModeDate;
    //datePicker.maximumDate=[NSDate date];

    [pickerVieww addTarget:self
                    action:@selector(pickerChanged:)
          forControlEvents:UIControlEventValueChanged];

    pickerVieww.minimumDate =  [NSDate date];
    [pickeView release];


我从pickerChanged 2012-11-14 22:00:00 +0000得到了这个日期

任何想法提前谢谢

最佳答案

您在datePickingDone完成一次

NSDateFormatter *dateformat=[[NSDateFormatter alloc]init];
        [dateformat setDateFormat:@"dd/MM/YY"];
        NSString *formattedDate=[dateformat stringFromDate:urReceivedDate];
    [dateformat release];

关于iphone - 如何格式化UIDatepicker日期?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7776986/

10-11 07:16