title: PHP - Comparing date, checking if within last hour
body: <p>I'm attempting to see if a time is within the last hour.</p>
  <pre><code>$unit_date = date($unit['last_accessed'], 'Y-m-d H:i:s');
  
  $last_hour = date('Y-m-d H:i:s', strtotime('-1 hour')); 
  
  if($unit_date &gt;= $last_hour ){
      $connect = &quot;&lt;i class='fa fa-circle 2x' style='color:#2ECC71;'&gt;&lt;/i&gt;&quot;;
  } else {
      $connect = '';
  }
  </code></pre>
  <p>As you can see I'm putting $unit['last_accessed'] into the correct format then comparing to an hour ago. If the time is within the last hour $connect is a font awesome circle (colored green), if it's not within the last hour it's empty, right now it's saying nothing is within the last hour which is false.</p>