title: Find difference between two datetimes and format at Y-m-d H:i:s
body: <p>I'm trying to get the difference between two datetimes and return it as a <code>datetime</code>. I've found examples using <code>diff</code> but I can't seem to get it right.</p>
  
  <pre><code>$timein = date("Y-m-d H:i:s");
  $timeout = date("Y-m-d 20:00:00");
  $totaltime = $timein-&gt;diff($timeout);
  </code></pre>
  
  <p>However <code>$totaltime</code> logs <code>0000-00-00 00:00:00</code> to my DB. Is this because I'm not formatting my totaltime variable?</p>