Q: Unable to unlock the previous months and dates in UIDatepicker And also showing the Time in ios In my project I need to show the date 18 back and lock the 100 years I tried like this I got it but here am locking days and months for that year(1912) also I need to show all the days and months for that year(1912) and one more thing when I select date it is showing along with time i Don't wanna show the time can any one solve this issue  
 -(IBAction)donePickerView:(id)sender
 {

 NSDate *minDate1 =[datePickerView date];
NSString *theDate = [NSString stringWithFormat:@"%@",minDate1];

 self.dob.text = theDate;
 DatePicView.hidden = TRUE;
  datePickerView.hidden =TRUE;


}
-(void)textFieldDidBeginEditing:(UITextField *)textField {  
   [self scrollViewToCenterOfScreen:textField];
   scrlView.scrollEnabled = FALSE;
    if (textField == dob) 
{
   DatePicView.hidden = FALSE;
   datePickerView.hidden =FALSE;
   NSCalendar * gregorian = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];

   NSDate * currentDate = [NSDate date];


   NSDateComponents * comps = [[NSDateComponents alloc] init];
   [comps setYear: -18];
   NSDate * maxDate = [gregorian dateByAddingComponents: comps toDate: currentDate options: 0];
   [comps setYear: -100];
   NSDate * minDate = [gregorian dateByAddingComponents: comps toDate: currentDate options: 0];

      [datePickerView setMinimumDate:minDate];
   [datePickerView setMaximumDate:maxDate];
   [datePickerView setDate:minDate];
         [dob resignFirstResponder];

       }
}


A: You set the maxDate to a -100 years.
So the maxDate is lower then the minDate, should these be the other way arround?
NSLog(@"Now: %@", currentDate);
NSLog(@"Max: %@", maxDate);
NSLog(@"Min: %@", minDate);


Now: 2012-10-18 10:04:43 +0000
Max: 1994-10-18 11:04:43 +0000
Min: 1912-10-18 11:45:11 +0000

This if you select 1980-12-12 this is lower then the max date and higher then the minimal date.
UIDatePicker *pickerView = [[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, 320, 300)];
//  add this to display date only.
[pickerView setDatePickerMode:UIDatePickerModeDate];

[pickerView setMinimumDate:minDate];
[pickerView setMaximumDate:maxDate];
[pickerView setDate:minDate];
[[self view] addSubview:pickerView];
[pickerView setDatePickerMode:UIDatePickerModeDate];

