title: PostgreSQL: Convert MongoDB date format to timestamptz
body: <p>I have referred to the psql <a href="https://www.postgresql.org/docs/current/static/functions-formatting.html" rel="nofollow noreferrer">documentation</a> and came up with this query.</p>
  
  <p><code>SELECT to_timestamp('Tue Aug 30 2016 04:07:13 GMT+0530 (IST)', 'Dy MON DD YYYY HH24:MI:SS');</code></p>
  
  <p>This date time string <code>Tue Aug 30 2016 04:07:13 GMT+0530 (IST)</code> is what I got from MongoDB printjson(createdAt).</p>
  
  <p>The above postresql doesn't seem to work correctly for all offsets.</p>
  
  <p>I tried this</p>
  
  <pre><code>select to_timestamp('Tue Aug 30 2016 04:07:13 GMT+0530 (IST)', 'Dy MON DD YYYY HH24:MI:SS "GMT"OF "(IST)"');
  </code></pre>
  
  <p>But I get this error ``ERROR:  "TZ"/"tz"/"OF" format patterns are not supported in to_date`.</p>
  
  <p>How to convert to psql timestamptz format from this string <code>Tue Aug 30 2016 04:07:13 GMT+0530 (IST)</code> ?</p>