NSDate timeIntervalSince1970 not working in Swift? [duplicate]

1432233446145 most probably is a time interval given in milliseconds:

let date = NSDate(timeIntervalSince1970: 1432233446145.0/1000.0)
print("date is \(date)")
// date is 2015-05-21 18:37:26 +0000

Swift 3 and later:

let date = Date(timeIntervalSince1970: 1432233446145.0/1000.0)

Leave a Comment