28

I'm getting dates as Unix timestamps through my API and I want to convert them into NSDate objects in Swift.

How can I do that?

Pang
  • 9,564
  • 146
  • 81
  • 122
dead_man
  • 409
  • 1
  • 6
  • 10
  • 15
    Why down vote and close this question ?? It is very legitimate for a new iOS programmer. I actually found this question because I was asking myself the same thing. – Regis St-Gelais Oct 20 '15 at 18:03

1 Answers1

60

Try this:

var date = NSDate(timeIntervalSince1970: timeInterval)
Marcos Crispino
  • 8,018
  • 5
  • 41
  • 59