title: Postgres create function for timestamp conversion
body: <p>I'm trying to create a postgres function which converts the input timestamp to PDT. Here is my code:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION getPdtTimestamp(inTS TIMESTAMP) RETURNS TIMESTAMP AS $$
  DECLARE
      outTS TIMESTAMP;
  BEGIN
      SELECT TIMESTAMP with time zone inTS AT TIME ZONE 'PDT' INTO outTS;
      RETURN outTS;
  END;
  $$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>The error I get here is:</p>
  
  <pre><code>syntax error at or near "inTS"
  </code></pre>
  
  <p>My goal is to make a function of a query which looks like this:</p>
  
  <pre><code>SELECT TIMESTAMP with time zone '2012-01-01 12:00:00' AT TIME ZONE 'PDT';
  // returns a value
  </code></pre>
  
  <p>Thanks in advance</p>