title: How can I convert time to decimal number in JavaScript?
body: <p>I'm too lazy to fill out my time sheet at work by the end at the end of every month, so I've started adding some functions to our PDF form. Acrobat Pro offers to make advanced calculations using JavaScript, but I'm stuck with this problem.</p>
  <p>I have two fields in which I enter the time when I start/end working. I want to calculate my overtime and output the result in a third field. however, I want the output to be decimal, so when I make half an hour overtime, the result would be 0.5</p>
  <p>Example: my work time is 8.5 hours, I start a 7.30 and finish at 16.00 (4 pm).</p>
  <p>My code so far:</p>
  <pre><code>var workTime = this.getField(&quot;Work time&quot;).value;
  var startTime = this.getField(&quot;Start time&quot;).value;
  var endTime = this.getField(&quot;End time&quot;).value;
  
  event.value = workTime - (endTime - startTime);
  </code></pre>