i've some issue to found a proper solution in swift3 to do this :
I have a date like 10h20m. When my hours are under 10 it will be "5h30". I want to out "05h30".
class func getTime(_ user: SUser) -> String { let currentDate = Date() let firstDate = user.firstDate let difference = firstDate?.timeIntervalSince(now) let hours = String(Int(difference!) / 3600) let minutes = String(Int(difference!) / 60 % 60) let time = "\(hours)h\(minutes)m" return time } if someone have an idea how do that simply et properly thank you !
DateComponentsFormatter