Re: timestamp with time zone

From: Tatsuo Ishii <ishii(at)postgresql(dot)org>
To: magnus(at)hagander(dot)net
Cc: jd(at)commandprompt(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: timestamp with time zone
Date: 2007-12-13 15:10:09
Message-ID: 20071214.001009.67102034.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: "Magnus Hagander" <magnus(at)hagander(dot)net>
Subject: Re: [GENERAL] timestamp with time zone
Date: Thu, 13 Dec 2007 07:45:18 +0100
Message-ID: <200712130745190000(at)2192011050>

> > > Tatsuo Ishii wrote:
> > > > Hi,
> > >
> > > > test=# select t at time zone 'jst' from t2;
> > > > timezone
> > > > -------------
> > > > 17:34:56+09
> > > > (1 row)
> > > >
> > > > test=# select t::time from t2;
> > > > t
> > > > ----------
> > > > 12:34:56
> > > > (1 row)
> > >
> > > Hello,
> > >
> > > timezone_test=# select cast(t as time with time zone) from t2;
> > > t
> > > -------------
> > > 12:34:56+04
> > > (1 row)
> > >
> > > ?
> >
> > I know that I can it with time with time zone. What I cannot do with
> > is, timestamp with time zone.
> >
> > test=# \d t1
> > Table "public.t1"
> > Column | Type | Modifiers
> > --------+--------------------------+-----------
> > t | timestamp with time zone |
> >
> > test=# insert into t1 values('2007-12-13 12:34:56 +0400');
> > INSERT 0 1
> > test=# select * from t1;
> > t
> > ------------------------
> > 2007-12-13 17:34:56+09
> > (1 row)
> >
> > Can I get "+04" without knowing that I inserted the data using "+0400"
> > time zone?
>
> No. The closest you can get is to store the tz in a different column and use AT TIMEZONE (which accepts a column name as argument)

Or use date + time with time zone.
--
Tatsuo Ishii
SRA OSS, Inc. Japan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message robert 2007-12-13 15:20:13 Re: mssql migration and boolean to integer problems
Previous Message Kris Jurka 2007-12-13 14:54:53 Re: jdbc lob and postgresql