Get Unix Epoch Time in Swift

2 Solutions Collect From Internet About “Get Unix Epoch Time in Swift”

You can simply use NSDate’s timeIntervalSince1970 function.

let timeInterval = NSDate().timeIntervalSince1970

For Swift 3.0

Date().timeIntervalSince1970