X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 271989DCAA6 for ; Wed, 7 Dec 2005 23:35:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 49876-04 for ; Wed, 7 Dec 2005 23:35:09 -0400 (AST) X-Greylist: delayed 01:31:55.004803 by SQLgrey- Received: from mxsf08.cluster1.charter.net (mxsf08.cluster1.charter.net [209.225.28.208]) by postgresql.org (Postfix) with ESMTP id D459D9DD710 for ; Wed, 7 Dec 2005 23:35:02 -0400 (AST) Received: from mxip02a.cluster1.charter.net (mxip02a.cluster1.charter.net [209.225.28.132]) by mxsf08.cluster1.charter.net (8.12.11/8.12.11) with ESMTP id jB83Z6lk028071 for ; Wed, 7 Dec 2005 22:35:06 -0500 Received: from 68-118-182-213.dhcp.nwtn.ct.charter.com (HELO [192.168.116.102]) ([68.118.182.213]) by mxip02a.cluster1.charter.net with ESMTP; 07 Dec 2005 22:33:06 -0500 X-IronPort-AV: i="3.99,227,1131339600"; d="scan'208"; a="1694697366:sNHT95513036" Message-ID: <4397A972.8060007@NarrowPathInc.com> Date: Wed, 07 Dec 2005 22:33:06 -0500 From: Keith Worthington Reply-To: KeithW@NarrowPathInc.com Organization: Narrow Path, Inc. User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org CC: Michael Glaesemann Subject: Re: dow question References: <43979459.9020500@NarrowPathInc.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.533 required=5 tests=[AWL=0.533] X-Spam-Score: 0.533 X-Spam-Level: X-Archive-Number: 200512/67 X-Sequence-Number: 23609 Michael Glaesemann wrote: > > On Dec 8, 2005, at 11:03 , Keith Worthington wrote: > >> Is there a better way to do this? The CASE seems inefficient and >> wordy but perhaps not. >> >> I was hoping for >> >> day_name(tbl_detail.ship_by_date) || tbl_detail.ship_by_date::text AS >> sort_by_string >> >> but AFAIK day_name(date) or something like it is merely my fantasy. ;-) > > > Will to_char() do what you want? Something like > > test=# select to_char(current_date, 'Day YYYY-MM-DD'); > to_char > ---------------------- > Thursday 2005-12-08 > (1 row) > > http://www.postgresql.org/docs/current/interactive/functions- > formatting.html > > Michael Glaesemann > grzm myrealbox com Michael, That will do nicely. I didn't realize until now after your tip and reading the to_char documentation how much I could do with to_char. to_char(tbl_detail.ship_by_date, 'FMDay, YYYY/MM/DD') AS ship_by_string, is exactly what the doctor ordered. Thanks for the tip. -- Kind Regards, Keith