I want to get the start and end time from the date that I select from the datepicker.
here is my code
func handleDatePicker(sender: UIDatePicker) { let dateFormatter = NSDateFormatter() dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" let startOfDay = NSCalendar.currentCalendar().startOfDayForDate(sender.date) let components = NSDateComponents() components.hour = 23 components.minute = 59 components.second = 59 let endOfDay = NSCalendar.currentCalendar().dateByAddingComponents(components, toDate: startOfDay, options: NSCalendarOptions(rawValue: 0)) }
but I get a conclusion like 2016-10-12 12:00:00
My question is how to get, how to get a conclusion like this
12-09-2016 00:00:00 AND 12-09-2016 23:59:59
source share