title: How to calculate time difference between current time and yesterday date with static time
body: <p>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.</p>
  
  <p>This is the code I used to get the current time:</p>
  
  <pre><code>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)")
  </code></pre>