dbTalk Databases Forums  

formatting timestamptz for more precision?

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss formatting timestamptz for more precision? in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Christopher.Becker@apcc.com
 
Posts: n/a

Default formatting timestamptz for more precision? - 06-21-2004 , 03:24 PM










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 hh:mm:ss.ms. Is there someway to do a format
within the select so that I can see the miliseconds as well as the rest of
the time?

--Chris



---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)


Reply With Quote
  #2  
Old   
CoL
 
Posts: n/a

Default Re: formatting timestamptz for more precision? - 06-21-2004 , 07:03 PM






hi,

Christopher.Becker (AT) apcc (DOT) com wrote, On 6/21/2004 22:24:
Quote:
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 hh:mm:ss.ms. Is there someway to do a format
within the select so that I can see the miliseconds as well as the rest of
the time?
try:
SELECT current_timestamp;

C.


Reply With Quote
  #3  
Old   
Tom Lane
 
Posts: n/a

Default Re: formatting timestamptz for more precision? - 06-21-2004 , 08:48 PM



Christopher.Becker (AT) apcc (DOT) com writes:
Quote:
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 hh:mm:ss.ms.
Well, you can't see precision that isn't there. How are you inserting
data?

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)".
Example:

regression=# create table foo(f1 timestamptz);
CREATE TABLE
regression=# insert into foo values(now());
INSERT 155060 1
regression=# select * from foo;
f1
-------------------------------
2004-06-21 21:44:47.344823-04
(1 row)

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


regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo (AT) postgresql (DOT) org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.