title: How can i subtract date and time in mongodb?
body: <p>I have create one document with date and time </p>
  
  <pre><code>use testing
  db.test.insert({employee : 1, DateColumn1: new Date(), DateColumn2: new Date()})
  </code></pre>
  
  <p>After created the document, i have update DateColumn2 after 5 mins.</p>
  
  <pre><code>db.test.update({employee : 1}, {$set : {DateColumn2: new Date()}})
  </code></pre>
  
  <p>i tried this command to subtract the DateColumn2-DateColumn1 but it is showing numberlong format.</p>
  
  <pre><code>db.test.aggregate([{$project :{employee : 1, dateDifference: {$subtract: ["$DateColumn2","$DateColumn1"]}}}])
  </code></pre>
  
  <p>I need date and time format to display</p>