Mobile App Dev Diary

Android (Java, Kotlin), iOS (Swift), Xamarin (C#)

Swift 3.0 / Convert Unix Timestamp to String

Convert Unix Timestamp to String in Swift version 3.0.

let dateUnix:TimeInterval = TimeInterval()
let date = Date(timeIntervalSince1970: dateUnix)
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy/MM/dd HH:mm:ss"
let dateString = dateFormatter.string(from: date)

Related entry:

python.hatenablog.jp

Remove all ads