Hide dates in UIDatePicker in iOS

1k Views Asked by At

I want to hide the past as well as future dates from my UIDatePicker. Only want to show today's date. Is it possible? Right now all the dates are coming, but only today's date is selecting. Time is also there. So in short I want to select today's date time by showing today's date only.

1

There are 1 best solutions below

0
On

Than no need to add DatePicker.

NSDateFormatter *formatter;
NSString        *dateString;

formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"dd-MM-yyyy"];
dateString = [formatter stringFromDate:[NSDate date]];