> I have a query which needs to provide a monthly report. Thanks to the
> date_trunc() function someone mentioned in a thread earlier today, I got
> the query working properly. However, each month is '2004-10-01 00:00:00'
> and I would like to have "October 2004".
> Which function, if any, would help me do this formatting trick? And
> where can I read more about it?
Try to_char(the_date_you_want_to_display, 'MonthYYYY') for that. Note
that there actually is no need to use date_trunc here as to_char will
only represent only what you ask for anyway. You can find more in the
PostgreSQL Online Manual at http://www.postgresql.org/docs/manuals/
(select the one for the version you are using). The chapter is
'Functions and Operators', section 'Data Type Formatting Functions'.
In response to
pgsql-novice by date
|Next:||From: Sean Davis||Date: 2005-01-25 02:08:58|
|Subject: Re: Formatting a month in query output|
|Previous:||From: Sean Davis||Date: 2005-01-25 02:05:44|
|Subject: Re: Output HTML, or just a handle?|