title: how to convert YYYYMMDDHHMMSS to 2013-11-24 11:29:07 in postgres
body: <p>Postgres char(14) fields stores datetime withou separators like 20131124112907</p>
  
  <p>How to add separators so that result is string in format</p>
  
  <p>2013-11-24 11:29:07</p>
  
  <p>I tried Denis answer using</p>
  
  <pre><code>to_timestamp(timestamp, 'YYYYMMDDHHMISS')::text as updated_at
  </code></pre>
  
  <p>but got exception</p>
  
  <pre><code>  Message=ERROR: 22007: hour "15" is invalid for the 12-hour clock
    Code=22007
  
    File=src\backend\utils\adt\formatting.c
    Hint=Use the 24-hour clock, or give an hour between 1 and 12.
  </code></pre>