I'm trying to create a postgres function which converts the input timestamp to PDT. Here is my 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;
The error I get here is:
syntax error at or near "inTS"
My goal is to make a function of a query which looks like this:
SELECT TIMESTAMP with time zone '2012-01-01 12:00:00' AT TIME ZONE 'PDT';
// returns a value
Thanks in advance