From: | 100(dot)179370(at)germanynet(dot)de (Martin Jacobs) |
---|---|
To: | "Alex Cheung Tin Ka [CD]" <tkcheung(at)vtc(dot)edu(dot)hk> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to timestamp |
Date: | 2002-01-05 14:27:46 |
Message-ID: | Pine.LNX.4.33.0201051342080.9507-100000@Schnecke.Windsbach.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi Alex,
On Thu, 27 Dec 2001, Alex Cheung Tin Ka [CD] wrote:
> Dear everybody,
> I would like to know how to create a timestamp value without time zone.
> I have encountered a problem that I have set following values in the table.
>
> create table test(
> a timestamp without time zone
There is a data type without time zone. It's just called
'timestamp'
So try:
create table test (a timestamp);
insert into test (a) values (current_timestamp);
select * from test;
and you will get something like:
2002-01-05 13:40:29+01
According to PostgreSQL documentation all timestamp data is
displayed with time zone info in various flavours (ISO, SQL,
Postgres, national variants, ...). Data type 'timestamp'
stores it's data without timezone in contrast to data type
'timestamp with time zone'. For timestamp without time zone
PostgreSQL assumes time zone of your machine.
Timestamp data is 8 byte numeric data, what you see is a
converted character represenation. To get your own character
representaion of timestamp, use conversion function to_char(),
example:
select to_char(a, 'YY-MM-DD HH24:MI:ss') from test;
could give you something like:
2002-01-05 13:40:29
For more details have a look at Chapter 5 of PostgreSQL
documentation: 'Formatting Functions'
> );
> INSERT INTO test (a) VALUES(current_timestamp);
>
> but the value of a always shows the zone value like this "2001-12-27 14:54:47+08"
> How to get rid of the last "+08" value?
> ...
Hope this helps.
Martin
--
Dipl-Ing. Martin Jacobs * Germany
Registered Linux User #87175, http://counter.li.org/
From | Date | Subject | |
---|---|---|---|
Next Message | Brent R. Matzelle | 2002-01-05 15:09:58 | Re: PostgreSQL GUI |
Previous Message | tony | 2002-01-05 11:08:00 | Re: PostgreSQL GUI |