How to convert a floating point value greater than Int.max to Int in Swift

2 Solutions Collect From Internet About “How to convert a floating point value greater than Int.max to Int in Swift”

Int64 is large enough to hold a time interval of some million
years measured in milliseconds:

let milliSeconds = Int64(someDate.timeIntervalSince1970 * 1000)
let milliSecondsString = String(milliSeconds)

Int64 is enough to hold the value you needed

let floatingPointValue = NSDate().timeIntervalSince1970 * 1000
let intValue = Int64(floatingPointValue)