title: php - calculating distance divded by time
body: <p>How do I divide a decimal by time queried from database as time format.</p>
  
  <p>Any idea?</p>
  
  <pre><code>$time = date($entity-&gt;getTime()-&gt;format('H:i:s'));
  $speed = $distance/$time
  </code></pre>
  
  <p>Which is definitely wrong and if my time is 00:40:00, I get some division by zero error.</p>
  
  <p>I am unable to convert it to seconds because php takes DateTime from Time format in database.</p>