Set Minimum date to UIDatePicker
11,949
Solution 1
Convert your UILabel text in to date format using NSDateFormatter
and put that value replacing "Date" in following example:
UIDatepicker *datePicker;
NSDate *Date=[NSDate date];
datePicker.minimumDate=Date;
Solution 2
You can use NSDateFormatter
and use setDateFormat
method for setting Date format.
[formatter setDateFormat:@"MMM dd,yyyy"];
NSDate *date = [formatter dateFromString:lblDate.text];
datePicker.minimumDate=date;
Comments
-
iphonedev23 about 2 years
I have a date in UILabel(like 'Dec 14, 2010). This date i want to set as minimum date of my UIDatepicker. How can i do this please reply?
Thanks Nishant