Re: help with to_date and to_char

From: Thomas F(dot)O'Connell <tfo(at)sitening(dot)com>
To: Edmund Bacon <ebacon(at)onesystem(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: help with to_date and to_char
Date: 2004-10-20 03:29:36
Message-ID: 4489EDEA-2248-11D9-A5E5-000D93AE0944@sitening.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Yup, even better. For some reason I gave up trying to_date( '02', 'MON'
), which clearly wasn't working.

Thanks for the improvement!

-tfo

--
Thomas F. O'Connell
Co-Founder, Information Architect
Sitening, LLC
http://www.sitening.com/
110 30th Avenue North, Suite 6
Nashville, TN 37203-6320
615-260-0005

On Oct 19, 2004, at 6:00 PM, Edmund Bacon wrote:

> Thomas F.O'Connell wrote:
>> There might be a better way, but this should do what you want. And I
>> think that you can safely replace '05' with when_month.
>> select to_char( to_date( '05' || '/' || to_char( current_date,
>> 'DD/YYYY' ), 'MM/DD/YYYY' ), 'MON' );
>
> Perhaps
> select to_char(to_date('02', 'MM'), 'MON');
>
> is better. When current_date is, say Aug 31 then
>
> select to_char( to_date('05' || '/' || to_char(current_date,
> 'DD/YYYY'),
> 'MM/DD/YYYY' ), 'MON' );
>
> returns 'MAR', which is probably not what you want.
>
> This works with 7.3.2, 7.4.5 and 8.0beta2.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Muhyiddin A.M Hayat 2004-10-20 04:43:00 Cross tabulations
Previous Message Postgres User 2004-10-20 02:41:11 Which type of functions are best?