title: Converting a timestamp in milliseconds in Postgres
body: <p>I have a timestamp in milliseconds:</p>
  
  <pre><code>1420066991000
  </code></pre>
  
  <p>That <a href="http://currentmillis.com/" rel="noreferrer">translates</a> into UTC:</p>
  
  <pre><code>Wed Dec 31 2014 23:03:11
  </code></pre>
  
  <p>and local time:</p>
  
  <pre><code>Thu Jan 01 2015 00:03:11
  </code></pre>
  
  <p>However if I try to convert it into a timestamp in Postgres, using to_timestamp, it gives me a wrong datetime:</p>
  
  <pre><code>select to_timestamp(1420066991000);
  46970-02-17 13:03:20+00
  </code></pre>
  
  <p>Since to_timestamp, <a href="http://www.postgresql.org/docs/9.3/static/functions-formatting.html" rel="noreferrer">expects a double precision input</a>, I also did this:</p>
  
  <pre><code>select to_timestamp(1420066991000.0);
  46970-02-17 13:03:20+00
  </code></pre>
  
  <p>but the results are the same.</p>
  
  <p>Am I missing something in my Postgres configuration, like some timezone setting? or is it a bug?</p>