0

I'm trying to format a label to say "_ minutes ago". How would I go about it?

I have it formatted right now to just say, for example, "11:45 PM".

let dateFormatter = DateFormatter()
dateFormatter.calendar = Calendar.current
dateFormatter.timeStyle = .short
let date = dateFormatter.string(from: peek.timestamp)
peekTimeLabel.text = "\(date)"
rmaddy
  • 314,917
  • 42
  • 532
  • 579
Gar
  • 901
  • 1
  • 7
  • 9
  • If you trying to set label after app started you can set timer with swift Timer() and update it after 60 secounds – Arashk Jan 27 '17 at 21:37
  • See [these search results](http://stackoverflow.com/search?q=%5Bswift%5D+doesRelativeDateFormatting). – rmaddy Jan 27 '17 at 21:39

0 Answers0