Обсуждение: Timezone conversion

Поиск
Список
Период
Сортировка

Timezone conversion

От
Jeff Boes
Дата:
Is there a straightforward way to change the display of a time to another
timezone?  For example, my server's environment is EST (-0500); I want to
convert timestamps for display in PST (-0800).  What I've been doing is to use a
Pl/Pgsql function to subtract the current timezone-offset and add in the desired
one.  Is there a way to do it without arithmetic?



Re: Timezone conversion

От
Stephan Szabo
Дата:
On Thu, 13 Feb 2003, Jeff Boes wrote:

> Is there a straightforward way to change the display of a time to another
> timezone?  For example, my server's environment is EST (-0500); I want to
> convert timestamps for display in PST (-0800).  What I've been doing is to use a
> Pl/Pgsql function to subtract the current timezone-offset and add in the desired
> one.  Is there a way to do it without arithmetic?

I think you might be able to use "AT TIME ZONE" to do what you want.  I
think it's described in Chapter 6 of the user's guide.




Re: Timezone conversion

От
Tom Lane
Дата:
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> On Thu, 13 Feb 2003, Jeff Boes wrote:
>> Is there a straightforward way to change the display of a time to another
>> timezone?  For example, my server's environment is EST (-0500); I want to
>> convert timestamps for display in PST (-0800).

> I think you might be able to use "AT TIME ZONE" to do what you want.  I
> think it's described in Chapter 6 of the user's guide.

Also, there's always the straightforward approach: temporarily change
the TIMEZONE variable ;-)

I believe AT TIME ZONE is new in 7.3.
        regards, tom lane