X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8CB5732AF0C for ; Wed, 20 Oct 2004 04:29:54 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 65383-04 for ; Wed, 20 Oct 2004 03:29:43 +0000 (GMT) Received: from window.monsterlabs.com (window.monsterlabs.com [216.183.105.176]) by svr1.postgresql.org (Postfix) with SMTP id 2F45D32AF0B for ; Wed, 20 Oct 2004 04:29:41 +0100 (BST) Received: (qmail 26614 invoked from network); 20 Oct 2004 03:29:40 -0000 Received: from pcp02680586pcs.nash01.tn.comcast.net (HELO ?192.168.0.114?) (68.52.123.224) by 0 with SMTP; 20 Oct 2004 03:29:40 -0000 In-Reply-To: <41759C78.1040101@onesystem.com> References: <416C74CC.6030309@dri.edu> <9E1E7300-2215-11D9-A5E5-000D93AE0944@sitening.com> <41759C78.1040101@onesystem.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <4489EDEA-2248-11D9-A5E5-000D93AE0944@sitening.com> Content-Transfer-Encoding: 7bit Cc: pgsql-sql@postgresql.org From: Thomas F.O'Connell Subject: Re: help with to_date and to_char Date: Tue, 19 Oct 2004 22:29:36 -0500 To: Edmund Bacon X-Mailer: Apple Mail (2.619) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/137 X-Sequence-Number: 19240 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.