dbTalk Databases Forums  

Re: Formating Dates

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


Discuss Re: Formating Dates in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ron St-Pierre
 
Posts: n/a

Default Re: Formating Dates - 04-06-2004 , 10:00 AM






Colin Gillespie wrote:

Quote:
Dear All,

I have table which has a column 'timestamp' and a default 'now()'. Using this method puts the date into table but includes upto milliseconds. How do I view only the date and time (not including seconds).

For example 2004-03-30 09:46:36.904064 would become 2004-03-30 09:46:36

Thanks

Colin

---------------------------(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)




Check out Section "6.7 Data Type Formatting Functions" of the manual for
all your options, but you would use something along the lines of :
select to_char(timestamp 'now','HH12:MI:SS');
to_char
----------
07:54:50
(1 row)

There are a lot of year, month and day formatting options eg(Y, YY, YYY,
YYY, Mon, etc etc), so you would add these formatting options to the
time ones eg:
select to_char(timestamp 'now','Y-Mon-DD HH12:MI:SS');
to_char
-------------------
4-Apr-06 08:00:22
(1 row)

hth

Ron


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html



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.