I don’t know how right it is wrong, but his work is for me
-(void)selectedTime{
NSDateFormatter *outputFormatter = [[NSDateFormatter alloc] init];
[outputFormatter setDateFormat:@"HH:mm:ss"];
selectedTime = [outputFormatter stringFromDate:datePicker.date];
NSArray *temp=[selectedTime componentsSeparatedByString:@":"];
NSLog(@"%@",temp);
NSInteger mins=[[temp objectAtIndex:1]integerValue];
if (mins<=29) {
selectedTime=[NSString stringWithFormat:@"%@:%@:%@",[temp objectAtIndex:0],@"00",@"00"];
}else if (mins>=31 && mins<=59){
selectedTime=[NSString stringWithFormat:@"%@:%@:%@",[temp objectAtIndex:0],@"30",@"00"];
}else{
}
if (self.delegate && [self.delegate respondsToSelector:@selector(SelectedValue:)]) {
[self.delegate SelectedValue:selectedTime];
}
[self.popupController dismiss];
}
My interval is 30 minutes
source
share