获取当前时间戳
// 当前时间戳
let timestamp = Date().timeIntervalSince1970
// 秒级时间戳
let timeStamp2 = Int(timestamp)
// 毫秒级时间戳
let timeStamp3 = CLongLong(round(timestamp*1000))
例如:
let time = Date().timeIntervalSince1970
print(time) // 1586851311.174374
print(Int(time)) // 1586851311
print(CLongLong(round(time*1000))) // 1586851311174
网友评论