Confused by timezones

Поиск
Список
Период
Сортировка
От Alessio Bragadini
Тема Confused by timezones
Дата
Msg-id 3A3A0D4C.E80E6C12@albourne.com
обсуждение исходный текст
Ответы Re: Confused by timezones  (Karel Zak <zakkr@zf.jcu.cz>)
Re: Confused by timezones  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Sorry, I am trying to find my way in formatting timestamps for different
timezones and I am a little confused.

[ PostgreSQL 7.0.0 on alphaev6-dec-osf4.0f, compiled by cc ]

Let's imagine 
CREATE TABLE tztest (id SERIAL, v TEXT, ts TIMESTAMP DEFAULT now());

How can I format a 
SELECT to_char(ts,'DD/MM/YYYY HH:MI:SS')
in order to have the accompanying timezone for the timestamp?
If I select the ISO format, I ofcourse have it ('2000-12-15
13:09:59+02')
but I cannot find a to_char element for it, either in offset or codes
(which I'd prefer). 
Is this possible?

On a more general ground, I checked the 'Date/Time Data Types' section
of the user manual, but I don't manage to have the expected behaviour,
with either the PGTZ env variable or the SET TIMEZONE command. Here's an
example (my default is EET i.e. +02):

village=# select ts from tztest;          ts
------------------------2000-12-15 13:09:59+02
(1 row)
village=# set TimeZone TO PST;
SET VARIABLE
village=# select ts from tztest;          ts
------------------------2000-12-15 13:09:59+02
(1
row)                                                                         

or maybe I just don't understand the whole picture...

P.S. Ofcourse I can use external functions, e.g. Date::Manip since I
code in Perl, but I'd prefer to leave this task to the database itself.

-- 
Alessio F. Bragadini        alessio@albourne.com
APL Financial Services        http://village.albourne.com
Nicosia, Cyprus             phone: +357-2-755750

"It is more complicated than you think"    -- The Eighth Networking Truth from RFC 1925


В списке pgsql-sql по дате отправления:

Предыдущее
От: miguel sofer
Дата:
Сообщение: Re: How to represent a tree-structure in a relationaldatabase
Следующее
От: Karel Zak
Дата:
Сообщение: Re: Confused by timezones