dead_man dead_man - 1 year ago 143
Swift Question

How to convert Unix timestamp into Swift NSDate object?

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?

Answer Source

Try this:

var date = NSDate(timeIntervalSince1970: timeInterval)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download