title: Postgres time zones and formatting
body: <p>I know there are some similar questions about this, but I'm having a hard time understanding why my database is formatting times the way it is. </p>
  
  <p>I have a field called <code>created_at</code> and in the database the value is:</p>
  
  <pre><code>2017-03-30 11:01:25.976-04
  </code></pre>
  
  <p>It's 11am New York time, with a four-hour negative offset from UTC.</p>
  
  <p>I want it to display as <strong>11:01am</strong>. When I use <code>TO_CHAR()</code> to format it, though, it converts the time to UTC and shows <strong>3:01pm</strong>.</p>
  
  <pre><code>SELECT to_char(ledger.created_at, 'Mon DD YYYY HH12: MI AM') AS formatted_date ...
  </code></pre>
  
  <p>I can fix this by adding <code>AT TIME ZONE 'America/New_York'</code> but I don't like the idea of hard-coding that in my application. </p>
  
  <pre><code>SELECT to_char(ledger.created_at AT TIME ZONE 'America/New_York', 'Mon DD YYYY HH12: MI AM') AS formatted_date ...
  </code></pre>
  
  <p>It seems like the timestamp field <em>knows</em> what time it is already, and what time zone it's in (or at least the offset amount) and it displays 11am in the database itself.</p>
  
  <p>I also know I can <code>SET</code> the local time before each query and it will work, but again I'm wondering if there's an easier way. It seems like maybe I could strip the timezone information and just get the <strong>11:01am</strong> time that's in the database. If there isn't a way, I can live with it, but I needed to check.</p>
  
  <p>For context, this is within a Node and Express app using Sequelize.</p>