title: Datetime comparison PHP/Mysql?
body: <p>I'm trying to make something like this:</p>
  
  <pre class="lang-php prettyprint-override"><code>if (datetime - system date &gt; 15 minutes) (false)
  
  if (datetime - system date &lt;= 15 minutes) (true)
  </code></pre>
  
  <p>But I'm totally lost. I don't know how to make this operation in PHP.</p>
  
  <p>I'd like to see how I can pick that DateTime from my database and check if it's between the last 15 minutes of my server's time.</p>
  
  <p>The type of database is MySQL.</p>
  
  <hr>
  
  <p>Finally, I managed to do it thanks to Sammitch and the other ones, here i leave the snippet:</p>
  
  <pre class="lang-php prettyprint-override"><code>$now    = time();
  $target = strtotime($row[1]);
  $diff   = $now - $target;
  
  // 15 minutes = 15*60 seconds = 900
  if ($diff &lt;= 900) {
      $seconds = $diff;
  } else {
      $seconds = $diff;
  }
  </code></pre>