Re: Formatting a month in query output

From: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
To: "Rodolfo J(dot) Paiz" <rpaiz(at)simpaticus(dot)com>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Formatting a month in query output
Date: 2005-01-25 02:08:58
Message-ID: 003001c50282$d4d9ba50$7d75f345@WATSON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Check out the documentation here:

http://www.postgresql.org/docs/8.0/interactive/functions-formatting.html#FUNCTIONS-FORMATTING-TABLE

Something like
select to_char(date_col,'Month YYYY') from tablename;

might do the trick, if date_col is your column with a timestamp.

Sean

----- Original Message -----
From: "Rodolfo J. Paiz" <rpaiz(at)simpaticus(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Sent: Monday, January 24, 2005 8:42 PM
Subject: [NOVICE] Formatting a month in query output

> Hi!
>
> 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? Or must I use a PHP case statement in
> the web page to do this reformatting manually?
>
> Thanks,
>
> --
> Rodolfo J. Paiz <rpaiz(at)simpaticus(dot)com>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Jason Dixon 2005-01-25 02:13:43 Re: SQL and function reference?
Previous Message Alexander Borkowski 2005-01-25 02:06:18 Re: Formatting a month in query output