title: Calculating time difference with three time values
body: <p>I'm having trouble calculating a time (hours:minutes) difference between three time values presented as HH:mm strings.</p>
  
  <p>I'm calculating time worked in a day from time in, lunch time and time out.</p>
  
  <p>e.g. 
  var time_worked = time_out - lunch - time_in
  or 07:00 = 17:00 - 01:00 - 09:00</p>
  
  <p>I'm familiar with the php dates but the javascript date object is scary!</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>var time_in = $(".time-in").val(); // 09:00
  var time_out = $(".time-out").val(); // 17:00
  var lunch = $(".lunch").val(); // 01:00
  
  var time = time_out - lunch - time_in; // should be 07:00 or 7  
  </code></pre>