title: PHP compare time from SQL database with current time
body: <p>I would like to check if a time in an SQL database is more than a day old.
  I am able to read the datetime off the SQL row and get the current time. What I am unable to do, however, is add 1 day/24 hours to the time pulled from the row, and comparing the 2.</p>
  
  <pre><code>$currenttime = date("Y-m-d h:m:s");
  $tmstp = $row['datetime'];
  $newtime = date("Y-m-d h:m:s", $tmstp);
  echo $tmstp."&lt;br&gt;".$currenttime."&lt;br&gt;".$newtime;
  </code></pre>
  
  <p>returns the following:</p>
  
  <pre><code>Notice: A non well formed numeric value encountered in C:\xampp\htdocs\test.php on line 12
  0000-00-00 00:00:00
  2016-03-12 09:03:39
  1970-01-01 01:01:00
  </code></pre>
  
  <p>the null time is to be expected, I initialized the row but didn't pass a value to it. Setting it to anything other than null(including setting it to an arbitrary date more than 24 hours ago but after 1970-1-1 OR adding one hour to it:</p>
  
  <pre><code>$currenttime = date("Y-m-d h:m:s");
  $tmstp = $row['datetime'] + strtotime('+ 24 hours');
  $newtime = date("Y-m-d h:m:s", $tmstp);
  echo $tmstp."&lt;br&gt;".$currenttime."&lt;br&gt;".$newtime;
  </code></pre>
  
  <p>sets it to tomorrow at this time: </p>
  
  <pre><code>1457903185
  2016-03-12 10:03:25
  2016-03-13 10:03:25
  </code></pre>
  
  <p>Once I can get the expected values, how would I effectively compare the 2 values? 
  Thanks for any help</p>