0

I am new to Swift. Using a simple picker to select a time. I am finding (on both simulator and device) that when I spin the Minutes to the one desired, the output has a constant number of seconds appended. For example, if I select 11:33, the output will be 11:33:38. If I chose other minutes, the "38" seconds remains.

What I'd like is to spin Minutes and have the Seconds set to zero e.g. 11:33 would be 11:33:00...

Code here:

    @IBAction func pickerKeyTime(sender: UIDatePicker) {

    dKeyTime = sender.date

    let dateFormatter = NSDateFormatter()
    dateFormatter.dateFormat = "dd-MM-yyyy HH:mm:ss"
    let sKeyTime = dateFormatter.stringFromDate(sender.date)
    print(sKeyTime)


}
Jeremy
  • 883
  • 1
  • 20
  • 41

0 Answers0