From: Thomas F.O'Connell <tfo@sitening.com>
To: Edmund Bacon <ebacon@onesystem.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: help with to_date and to_char
Date: Tue, 19 Oct 2004 22:29:36 -0500
Message-ID: <4489EDEA-2248-11D9-A5E5-000D93AE0944@sitening.com> (raw)
In-Reply-To: <41759C78.1040101@onesystem.com>
References: <416C74CC.6030309@dri.edu>
<9E1E7300-2215-11D9-A5E5-000D93AE0944@sitening.com>
<41759C78.1040101@onesystem.com>
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: tfo@sitening.com, ebacon@onesystem.com
Subject: Re: help with to_date and to_char
In-Reply-To: <4489EDEA-2248-11D9-A5E5-000D93AE0944@sitening.com>
References: <416C74CC.6030309@dri.edu> <9E1E7300-2215-11D9-A5E5-000D93AE0944@sitening.com> <41759C78.1040101@onesystem.com> <4489EDEA-2248-11D9-A5E5-000D93AE0944@sitening.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox