title: PHP: Days, hours and minutes left to a certain date?
body: <p>I'm trying to get remaining Days, hours and minutes to a certain date using php.</p>
  
  <p>However i get a very strange output from my code which looks like this:</p>
  
  <pre><code>-16828 days and -11 hours and -21 minutes and -24 seconds 
  </code></pre>
  
  <p>The future dates are stored in the mysql database in this format:</p>
  
  <pre><code>29/01/2016 7pm
  </code></pre>
  
  <p>So I went ahead and done this:</p>
  
  <pre><code>$Draw_time = "29/01/2016 7pm";
  
  $date = $Draw_time;
  $timestamp = strtotime($date);
  $new_date = date('Y-m-d a',$timestamp );
  
  $seconds = strtotime($new_date) - time();
  
  $days = floor($seconds / 86400);
  $seconds %= 86400;
  
  $hours = floor($seconds / 3600);
  $seconds %= 3600;
  
  $minutes = floor($seconds / 60);
  $seconds %= 60;
  
  
  echo "$days days and $hours hours and $minutes minutes and $seconds seconds";
  </code></pre>
  
  <p>But when i run this code, I get the above strange output!</p>
  
  <p>I understand that this could be because of a number reasons but the only thing i could think of is the fact that I am using <code>a</code> in my format? </p>
  
  <p>Could someone please advise on this issue?</p>