title: Convert milliseconds to Timestamp
body: <p>I know that to convert a Unix timestamp in milliseconds to an SQL timestamp I can use</p>
  
  <pre><code>SELECT TO_DATE('1970-01-01','YYYY-MM-DD HH24:MI:SS') + 
         (:timestamp / (1000*60*60*24)) FROM DUAL;
  </code></pre>
  
  <p>But I need a Timestamp, so I tried with</p>
  
  <pre><code>SELECT TO_TIMESTAMP('1970-01-01 00:00:00','YYYY-MM-DD HH24:MI:SSFF3') + 
         (:timestamp) from DUAL
  </code></pre>
  
  <p>Which gives me the error:</p>
  
  <blockquote>
    <p>Error: ORA-01841: (full) year must be between -4713 and +9999, and not be 0</p>
  </blockquote>
  
  <p>It seems that adding 1 to the timestamp always converts it to a day.</p>
  
  <p>How can I do the same to get a real timestamp?</p>