at time zone question in pl/pgSQL

From: "Heather Grace" <heather(at)radiovoodoo(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: at time zone question in pl/pgSQL
Date: 2002-02-14 16:58:51
Message-ID: 008201c1b578$e0b4c1d0$1505a8c0@heatherlaptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Using postgresql version 7.1

I'm trying to write a simple pl/pgsql function that will return the current time for the given time zone ( i have to deal multiple time zones) . But I don't seem to be using the appropriate syntax. I keep getting an error on the 'at time zone...'

DECLARE
new_time TIMESTAMP;

BEGIN
SELECT INTO new_time now() at time zone 'PST'; /*just hard coding the time zone for now */

return new_time;

END;

The following select statement works from an SQL query:

SELECT now() at time zone 'PST'

and returns the appropriate time.

I have also tried using the following statements:

Set TimeZone to PST;
return now();

but that didn't give me the time for PST, only the default time zone, EST.

thanks in advance,

--heather grace

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gould 2002-02-14 17:00:20 Re: PRIMARY KEY and UNIQUE
Previous Message Hiroshi Inoue 2002-02-14 16:53:17 Re: [GENERAL] Postgres 7.2 - Updating rows in cursor problem