Skip site navigation (1) Skip section navigation (2)

Timestamp with time zone

From: Xavier Robin <xavier(dot)robin(at)bluewin(dot)ch>
To: pgsql-novice(at)postgresql(dot)org
Subject: Timestamp with time zone
Date: 2010-06-30 13:12:39
Message-ID: 4C2B42C7.3010403@bluewin.ch (view raw or flat)
Thread:
Lists: pgsql-novice
Hello,

I'm running a Debian Lenny box with PostgreSQL 8.4.4 from the backports.
I have a question regarding timestamps with time zone. I can't get time
zones inserted into my timestamp with time zone columns. For example:

> CREATE TABLE testcase(
> 	created TIMESTAMP WITH TIME ZONE
> );
> INSERT INTO testcase VALUES (TIMESTAMP WITH TIME ZONE '2005-01-01 00:00+01');
> SELECT created, EXTRACT(TIMEZONE FROM created) FROM testcase;
>         created         | date_part
> ------------------------+-----------
>  2004-12-31 23:00:00+00 |         0
> (1 ligne)

Or from the docs:

> SELECT TIMESTAMP WITH TIME ZONE '2004-10-19 10:23:54+02';
>       timestamptz
> ------------------------
>  2004-10-19 08:23:54+00

In both examples, the timezone is lost. I read that

> To ensure that a literal is treated as timestamp with time zone, give it the correct explicit type

but how can I do that in pactice?

Thanks,
Xavier


Responses

pgsql-novice by date

Next:From: Tim LandscheidtDate: 2010-06-30 14:25:31
Subject: Re: Timestamp with time zone
Previous:From: Xavier RobinDate: 2010-06-30 12:59:37
Subject: Timestamp with time zone

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group