Skip site navigation (1) Skip section navigation (2)

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 (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Check out the documentation here:

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

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


----- 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


pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group