Thread: Help with casting timestamp column
I need a bit of help. I have a table full of database stats that are all timestamped using the now() timestamp. However, I need to pull some consolidated reports that are based upon hourly activiy. Does anyone know of a way to get a timestamp column to return as mm/dd/yyyy hh? Thanks for any help, chris
select to_char(my_timestamp,'MM/DD/YYYY HH') from t; returns a string representation of the timestamp... HTH, CG --- Chris Hoover <revoohc@sermonaudio.com> wrote: > I need a bit of help. I have a table full of database stats that are > all timestamped using the now() timestamp. However, I need to pull some > consolidated reports that are based upon hourly activiy. Does anyone > know of a way to get a timestamp column to return as mm/dd/yyyy hh? > > Thanks for any help, > > chris > > > ---------------------------(end of broadcast)--------------------------- > TIP 8: explain analyze is your friend __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/
Check out the EXTRACT and date_part functions. See the PostgreSQL User's Guide for more information. -- Janet > -----Original Message----- > From: Chris Hoover [mailto:revoohc@sermonaudio.com] > Sent: Thursday, June 10, 2004 10:38 AM > To: pgsql-odbc@postgresql.org > Subject: [ODBC] Help with casting timestamp column > > > I need a bit of help. I have a table full of database stats that are > all timestamped using the now() timestamp. However, I need > to pull some > consolidated reports that are based upon hourly activiy. Does anyone > know of a way to get a timestamp column to return as mm/dd/yyyy hh? > > Thanks for any help, > > chris > > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend >
See also the function to_char. -- Janet > -----Original Message----- > From: Chris Hoover [mailto:revoohc@sermonaudio.com] > Sent: Thursday, June 10, 2004 10:38 AM > To: pgsql-odbc@postgresql.org > Subject: [ODBC] Help with casting timestamp column > > > I need a bit of help. I have a table full of database stats that are > all timestamped using the now() timestamp. However, I need > to pull some > consolidated reports that are based upon hourly activiy. Does anyone > know of a way to get a timestamp column to return as mm/dd/yyyy hh? > > Thanks for any help, > > chris > > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend >