title: Expiration date for some database entries
body: <p>I am trying to set an expiration on DB entries. I've set the field to <code>datetime</code> and entered some values manually through MySQL </p>
  
  <p>I take the value from the table and convert it to <code>strtotime()</code>. then I get the current time using <code>strtotime("now")</code>; or <code>time()</code>; they seemed to return the same value.</p>
  
  <p>I then take the future date(the one from the db) and with if statement check if its smaller then current time if so I set it as expired. if it's still bigger then current time I return how much time left..</p>
  
  <p>Here is the code for that:</p>
  
  <pre><code>$time_left = "";
  $value['ex_date'] = '2012-11-22 18:17:33';// this is whats in the DB now.
  $future_time = strtotime($value['ex_date']);
  $now_time = strtotime('now');
  
  if($deal_end &lt; $now_time){
      $time_left = 'Expired';
  }else{
      $seconds = $future_time - $now_time;
      $days = floor($seconds / 86400);
      $seconds %= 86400;
      $hours = floor($seconds / 3600);
      $seconds %= 3600;
      $minutes = floor($seconds / 60);
      $seconds %= 60;
  
      if($days &gt;= 1) {$time_left .= "D:$day ";}
      if($hours &gt;= 1) {$time_left .= "H:$hours ";}
      if($minutes &gt;= 1) {$time_left .= "M:$minutes ";}
      if($seconds &gt;= 1) {$time_left .= "S:$seconds ";}
  </code></pre>
  
  <p>For some reason the above doesn't work well. its like there is some time gap.</p>
  
  <p>my question is: is there a way to check server time vs database time ?</p>
  
  <p>because the <code>strtotime('now');</code> time seems different then current timestemp by like 2/3 hours for some reason.</p>