How can I convert the 24 hour time format to 12 hour time format?

Viewed 10891

I can get the 24 hour style time, but how do I get the 12 hour format with the am and pm?

let date = NSDate()
let calendar = NSCalendar.currentCalendar()
let components = calendar.components([.Hour, .Minute, .Second], fromDate: date)
let hour = components.hour
let minutes = components.minute
4 Answers
Related