Swift - 用秒数-转换-天时分秒
2020-05-13 本文已影响0人
biubiuboom
//MARK: -时间戳转时间函数
func timeStampToString(timeStamp: Int)->String {
///天
let days = Int(timeStamp/(3600*24))
///时
let hours = Int((timeStamp - days*24*3600)/3600)
///分
let minute = Int((timeStamp - days*24*3600-hours*3600)/60)
///秒
let second = Int((timeStamp - days*24*3600-hours*3600) - 60*minute)
let timeString = String.init(format: "%d:%d",hours,minute)
return timeString
}