title: Timestamp Difference In Hours for PostgreSQL
body: <p>Is there a <code>TIMESTAMPDIFF()</code> equivalent for PostgreSQL?  </p>
  
  <p>I know I can subtract two timestamps to get a postgresql <code>INTERVAL</code>.  I just want the difference between the two timestamps in in hours represented by an INT.  </p>
  
  <p>I can do this in MySQL like this:</p>
  
  <pre><code>TIMESTAMPDIFF(HOUR, links.created, NOW())
  </code></pre>
  
  <p>I just need the difference between two timestamps in hours represented as an integer.</p>
  
  <p><strong>Solution works for me:</strong></p>
  
  <pre><code>SELECT "links_link"."created",
  "links_link"."title",
  (EXTRACT(EPOCH FROM current_timestamp - "links_link"."created")/3600)::Integer AS "age" 
  FROM "links_link"
  </code></pre>