Re: Formatting a month in query output

Поиск
Список
Период
Сортировка
От Alexander Borkowski
Тема Re: Formatting a month in query output
Дата
Msg-id 41F5A99A.7050602@abri.une.edu.au
обсуждение исходный текст
Ответ на Formatting a month in query output  ("Rodolfo J. Paiz" <rpaiz@simpaticus.com>)
Список pgsql-novice
Hi Rodolfo,

> 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'.

HTH,

Alex

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Sean Davis"
Дата:
Сообщение: Re: Formatting a month in query output
Следующее
От: "Sean Davis"
Дата:
Сообщение: Re: Output HTML, or just a handle?