title: How to get millisecond between two dateTime obj?
body: <p>How to get millisecond between two <code>DateTime</code> objects? </p>
  
  <pre><code>$date = new DateTime();
  $date2 = new DateTime("1990-08-07 08:44");
  </code></pre>
  
  <p>I tried to follow the comment below, but I got an error.</p>
  
  <pre><code>$stime = new DateTime($startTime-&gt;format("d-m-Y H:i:s"));
  $etime = new DateTime($endTime-&gt;format("d-m-Y H:i:s")); 
  $millisec = $etime-&gt;getTimestamp() - $stime-&gt;getTimestamp();` 
  </code></pre>
  
  <p>I get the error</p>
  
  <blockquote>
    <p>Call to undefined method DateTime::getTimestamp()</p>
  </blockquote>