title: How to calculate difference between two dates using Node.js?
body: <p>I need to calculate the <code>datetime</code> difference using the node.js. I am using the <code>dateformat</code> package to get current datetime format. My code is below:</p>
  
  <pre><code>var dateFormat = require('dateformat');
  var prev_date=2017-08-09T19:00:58+0530;
  var now = new Date();
  var current_date=dateFormat(now, "isoDateTime");
  </code></pre>
  
  <p>Here I have already the previous date and also the current <code>datetime</code> also. I need to calculate the difference between two dates in hour, minute and second separately.</p>