Get Unix Epoch Time in Swift
You can get that using following
Int(Date().timeIntervalSince1970)
This is for current date, if you want to get for a given date
Int(myDate.timeIntervalSince1970)
If you want to convert back from UNIX time epoch to Swift Date time, you can use following
let date = Date(timeIntervalSince1970: unixtEpochTime)