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