From: Alessio Bragadini <alessio@albourne.com>
To: SQL for PostgreSQL list <pgsql-sql@postgresql.org>
Subject: Confused by timezones
Date: Fri, 15 Dec 2000 14:23:40 +0200
Message-ID: <3A3A0D4C.E80E6C12@albourne.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: alessio@albourne.com
Subject: Re: Confused by timezones
In-Reply-To: <3A3A0D4C.E80E6C12@albourne.com>
References: <3A3A0D4C.E80E6C12@albourne.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox