title: PostgreSQL - How to convert seconds in a numeric field to HH:MM:SS
body: <p>I'm new to PostgreSQL (I have been using MS SQL for many years) and need to convert a numeric column which contains a time in seconds to HH:MM:SS format.</p>
  
  <p>I have Googled and found that <code>to_char(interval '1000s', 'HH24:MI:SS')</code> works so I am attempting to use this with my field name:</p>
  
  <p><code>to_char(fieldname, 'HH24:MI:SS')</code> gives an error <code>cannot use "S" and "PL"/"MI"/"SG"/"PR"  together</code></p>
  
  <p><code>to_char(fieldname::interval, 'HH24:MI:SS')</code> gives an error <code>cannot cast type numeric to interval</code></p>
  
  <p>Can anyone show me where I am going wrong?</p>