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

Re: formatting timestamptz for more precision?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher(dot)Becker(at)apcc(dot)com
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: formatting timestamptz for more precision?
Date: 2004-06-22 01:48:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Christopher(dot)Becker(at)apcc(dot)com writes:
>> From what I've read, Postgres stores plenty of precision to contain
> milliseconds.  My question is, how do I see the milliseconds?  Just doing a
> select on a timestamptz column just gives me hh:mm:ss... but i'm looking
> for something more like

Well, you can't see precision that isn't there.  How are you inserting

The only way the column itself would be throwing away low-order digits
is if you declared it to, with a declaration like "timestamp(0)".

regression=# create table foo(f1 timestamptz);
regression=# insert into foo values(now());
INSERT 155060 1
regression=# select * from foo;
 2004-06-21 21:44:47.344823-04
(1 row)
regression=# create table bar (f1 timestamp(0) with time zone);
regression=# insert into bar values(now());
INSERT 155063 1
regression=# select * from bar;
 2004-06-21 21:46:36-04
(1 row)

			regards, tom lane

In response to

pgsql-novice by date

Next:From: PostgreSQL Bugs ListDate: 2004-06-22 09:29:29
Subject: BUG #1176: PHP connection
Previous:From: Christopher.BeckerDate: 2004-06-21 20:24:31
Subject: formatting timestamptz for more precision?

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