title: Calculate the difference in seconds between two epoch timestamps in Javascript
body: <p>I'm trying to calculate the difference (in seconds) between two EPOCH timestamps using Javascript.</p>
  
  <p>I have two timestamps:</p>
  
  <pre><code>START: 1565628094441
  END: 1565714527812
  </code></pre>
  
  <p>Both timestamps were obtained using: </p>
  
  <pre><code>var time = new Date().getTime().toString();
  </code></pre>
  
  <p>I would like to determine the difference between both timestamps in seconds. I understand that Javascript returns epoch in milliseconds but I still haven't been able to find a way to convert them to seconds properly.</p>
  
  <p>Here is what I've tried: </p>
  
  <pre><code>var differenceSec = (END- START)/1000;
  // This gives us 86433.371 Seconds (~1440 minutes). 
  </code></pre>
  
  <p>Using Epoch Converter (<a href="https://www.epochconverter.com/#tools" rel="nofollow noreferrer">https://www.epochconverter.com/#tools</a>) I know that the true difference should be around 30 seconds. What am I doing wrong here?</p>