title: Adding or Subtracting Time From Postgres Timestamps
body: <p>I am using the following ruby code, with the PG gem, to return a timestamp that is in Postgres "timestamp without timezone" format. Instead of returning the current value, I would like it to return the value (-1 hour).</p>
  
  <pre><code>def get_latest_timestamp(id)
    conn1 = PGconn.open(:dbname =&gt; 'testdb')
    res = conn1.exec("SELECT MAX(time_of_search) FROM listings WHERE id=#{id}")
    res.values[0][0]
  end
  </code></pre>