You do not need to juggle NSDateComponents or convert a date to a string and vice versa. You can specify the calendar to set the date to the beginning of the minute (hour / date / week / ...)
NSDate *date = self.datePicker.date; [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitMinute startDate:&date interval:NULL forDate:date];
vikingosegundo
source share