I have a current time and a static time (eg - yesterday 9.30 pm), I need to find the time difference between these two times in hh:mm:ss format.
This is the code I used to get the current time:
let date = Date()
let calendar = Calendar.current
let hour = calendar.component(.hour, from: date)
let minutes = calendar.component(.minute, from: date)
let seconds = calendar.component(.second, from: date)
print("hours = \(hour):\(minutes):\(seconds)")