Re: date functions

Поиск
Список
Период
Сортировка
От Jason Earl
Тема Re: date functions
Дата
Msg-id 1012580578.29742.5.camel@npa01zz001
обсуждение исходный текст
Ответ на date functions  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
Список pgsql-general
On Fri, 2002-02-01 at 06:53, Johnson, Shaunn wrote:
> Howdy:
>
> Silly question.  I want to display the date from
> my table in other formats.  Is this possible?
>
> For example, I have this:
>
> [example]
>
>     date
> ------------
>  2000-01-07
>
> [/example]
>
> And I want this:
>
> [example]
>
>     date
> ------------
>  20000107
>
> [/example]

SELECT to_char(current_date, 'YYYYMMDD');

> And maybe this:
>
>
> [example]
>
>     date
> ------------
>  01/07/2001
>
> [/example]

SELECT to_char(current_date, 'DD/MM/YYYY');

> Any suggestions?  Thanks!

The to_char function does precisely what you need.  You can find
excellent documentation in section 4.6 of the PostgreSQL User's guide.

Jason


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

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: Function to Pivot data
Следующее
От: "omid omoomi"
Дата:
Сообщение: Re: date functions