title: PHP: How to echo remaining time in minutes from microtime
body: <p>The following shows time in seconds, and want it in minutes, how do i convert to minutes?</p>
  
  <pre><code>$query = "SELECT * FROM messages WHERE ip = '$ip' AND mtime &gt;= NOW() - INTERVAL 5 MINUTE ORDER by mtime DESC";
  $result = mysql_query($query);
  
  if (mysql_num_rows($result) &gt; 0) {
      $row = mysql_fetch_assoc($result);
      $diff = microtime(true) - $row['mtime']; //here the time difference between last sended message and this try
      $remaining = (5*60 - (int) $diff);
     echo $remaining;
  }
  else {
      ...
  }
  </code></pre>
  
  <p>Thanks.</p>