X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id F2DB1D1C515 for ; Fri, 1 Aug 2003 18:29:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 58327-10 for ; Fri, 1 Aug 2003 15:28:48 -0300 (ADT) Received: from davinci.ethosmedia.com (209-128-84-228.bayarea.net [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 026C5D1C7EF for ; Fri, 1 Aug 2003 15:29:54 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3368313; Fri, 01 Aug 2003 11:30:15 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: tomg@sqlclinic.net, Postgres SQL List Subject: Re: What day is it - when it isn't NOW()? Date: Fri, 1 Aug 2003 11:28:25 -0700 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200308011128.25461.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/9 X-Sequence-Number: 14625 Thomas, > SELECT to_char(now(), 'Day'); returns Friday as I'd hoped. > But how do I return the day of the week for a specific date other > than now()? I'm looking for something along the lines of: > SELECT to_char('2003-08-04', 'Day') without much success. > > Can anyone point me to the right function/combination of functions > to achieve this? Well, you could try the online docs under "Functions and operators" . Two possibilities: SELECT to_char('2003-08-04'::TIMESTAMP, 'Day') should make the to_char version work for you. Alternately, SELECT EXTRACT(dow FROM '2003-08-04') will give you a numerical (0-6) day of the week. -- Josh Berkus Aglio Database Solutions San Francisco