Thread: formating dates

formating dates

From
Ângelo Marcos Rigo
Date:
Hi can i format dates from postgresql stored in the
aaa-mm-dd format to June 14 2005 - Tuesday ?

using just postgresql functions?

thank´s in advance


Ângelo Marcos Rigo
AMR Informática
(51) 3348 0870
Rua Pe. Alois Kades 400/210
Porto Alegre /RS/Brasil
http://amr.freezope.org
angelo_rigo@yahoo.com.br



__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger
http://br.download.yahoo.com/messenger/

Re: formating dates

From
Philip Hallstrom
Date:
> Hi can i format dates from postgresql stored in the
> aaa-mm-dd format to June 14 2005 - Tuesday ?
>
> using just postgresql functions?

Yes.

http://www.postgresql.org/docs/7.4/interactive/functions-formatting.html

Re: formating dates

From
Steve Crawford
Date:
On Tuesday 14 June 2005 12:44 pm, Ângelo Marcos Rigo wrote:
> Hi can i format dates from postgresql stored in the
> aaa-mm-dd format to June 14 2005 - Tuesday ?
>
> using just postgresql functions?

select to_char(now(), 'FMMonth dd yyyy - FMDay');

See to_char() documentation for more.

Cheers,
Steve


Re: formating dates

From
Bruno Wolff III
Date:
On Tue, Jun 14, 2005 at 16:44:25 -0300,
  Ângelo Marcos Rigo <angelo_rigo@yahoo.com.br> wrote:
> Hi can i format dates from postgresql stored in the
> aaa-mm-dd format to June 14 2005 - Tuesday ?
>
> using just postgresql functions?

You can use the to_char function. See:
http://www.postgresql.org/docs/8.0/static/functions-formatting.html

Note that dates aren't actually stored as aaa-mm-dd internally.
You might want something like:
area=> select to_char(current_date, 'Month DD YYYY Day');
           to_char
-----------------------------
 June      14 2005 Tuesday
(1 row)