title: Relative date formatting always outputs "3 hours ago"
body: <p>I am calculating the date interval between a specified date and the current date using php. I do this so I can print out social friendly timestamps like <code>A few mins ago</code> and <code>2 hours ago</code></p>
  
  <p>When I come to the hours part I get something behaving real funny in php. Below is the full working code but when you replace the <code>hours</code> part with this code it always prints out 3 hours.</p>
  
  <p>Defined constant DATE</p>
  
  <pre><code>// The current date timestamp
  define('DATE', time());
  </code></pre>
  
  <h3>Buggy code here:</h3>
  
  <pre><code>//Only the hours part that' doing something weird
  case ($interval &gt;= 3600 &amp;&amp; $interval &lt; 86400) :
              $return = ( date('H', $interval) &lt; 2)
                  ? (int)date('H', $interval) . ' hour ago'
                  : (int)date('H', $interval) . ' hours ago';
              break;
  </code></pre>
  
  <p>It breaks when the specified date, lets say in this case, <strong>create date</strong> is just over an hour ago thus resulting in an interval equal to 3660 seconds. It seems like the date method call <code>date('H', 3660)</code> results in 03. Shouldn't it result in 01? it is after all just over an hour.</p>
  
  <h3>Working code here:</h3>
  
  <pre><code>public static function getTimeInterval($date)
  {
      $interval = DATE - $date;
  
      $return = '';
  
      switch ( $interval )
      {
          case ($interval &lt;= 60) :
              $return = 'a few secs ago';
              break;
  
          case ($interval &gt; 60 &amp;&amp; $interval &lt; 3600) :
              $return = (int)date('i', $interval) . ' mins ago';
              break;
  
          case ($interval &gt;= 3600 &amp;&amp; $interval &lt; 86400) :
              $return = ( abs((date('G', DATE) - date('G', $date))) &lt; 2)
                  ? abs((date('G', DATE) - date('G', $date))) . ' hour ago'
                  : abs((date('G', DATE) - date('G', $date))) . ' hours ago';
              break;
  
          case ($interval &gt;= 86400 &amp;&amp; $interval &lt; 604800) :
              $return = ( (int)date('j', $interval) === 1)
                  ? (int)date('j', $interval) . ' day ago'
                  : (int)date('j', $interval) . ' days ago';
              break;
  
          case ($interval &gt; 604800 &amp;&amp; $interval &lt;= 2592000) :
              $return = 'A few weeks ago';
              break;
          case ($interval &gt; 2592000) :
              $return = date('n', $interval) . ' months ago';
              break;
          case ($interval &gt; 31536000) :
              $return = 'Over a year ago';
              break;
  
      }
  
      return $return;
  
  }
  </code></pre>