Received: from sapphire.albourne.com (sapphire.albourne.com [195.212.241.227]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eBFCNv096823 for ; Fri, 15 Dec 2000 07:23:57 -0500 (EST) (envelope-from alessio@albourne.com) Received: from albourne.com (akamas.albourne.com [195.212.241.254]) by sapphire.albourne.com (8.9.3/8.9.3/Albourne/CYS/1.9/MAPS) with ESMTP id OAA22905 for ; Fri, 15 Dec 2000 14:24:19 +0200 (EET) Message-ID: <3A3A0D4C.E80E6C12@albourne.com> Date: Fri, 15 Dec 2000 14:23:40 +0200 From: Alessio Bragadini Organization: APL Financial Services (Overseas) Ltd. X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.18pre21 i686) X-Accept-Language: it, en, sv MIME-Version: 1.0 To: SQL for PostgreSQL list Subject: Confused by timezones Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200012/163 X-Sequence-Number: 497 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