Re: date functions - Mailing list pgsql-general

From Jason Earl
Subject Re: date functions
Date
Msg-id 1012580578.29742.5.camel@npa01zz001
Whole thread Raw
In response to date functions  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
List 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 by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Function to Pivot data
Next
From: "omid omoomi"
Date:
Subject: Re: date functions