title: Subtract time in 24 hour format using javascript or jquery
body: <p>I have a start and end time in the format of HH:MM and I need to get the total time in hours. I have tried a couple methods like trimming the string to an hour and minutes then multiplying the hours by 60 and adding the minutes but since the minute string is two digits, 00 I get an answer that is a power of ten greater than what I need. I also feel like this approach is inefficient. </p>
  
  <p>So what is the best way to subtract 04:30 and 22:00? I also have access to moment.js if that is helpful. </p>