X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 611B3D7C79 for ; Tue, 8 Nov 2005 10:35:06 -0400 (AST) 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 12786-01 for ; Tue, 8 Nov 2005 14:35:01 +0000 (GMT) X-Greylist: delayed 03:09:46.712778 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 1BBD8D84D8 for ; Tue, 8 Nov 2005 10:35:02 -0400 (AST) Received: from iracema.dnscenter.com.br (iracema3.dnscenter.com.br [67.15.81.2]) by svr2.postgresql.org (Postfix) with ESMTP id 36F1AF0E23 for ; Tue, 8 Nov 2005 11:25:18 +0000 (GMT) Received: from cpanel by iracema.dnscenter.com.br with local (Exim 4.52) id 1EZRbE-0001ec-30 for pgsql-sql@postgresql.org; Tue, 08 Nov 2005 08:25:12 -0300 Received: from 200.158.187.211 ([200.158.187.211]) by www.presserv.org (Horde MIME library) with HTTP; Tue, 08 Nov 2005 08:25:11 -0300 Message-ID: <20051108082511.06n26rf2fc0gk8cg@www.presserv.org> Date: Tue, 08 Nov 2005 08:25:11 -0300 From: lucas@presserv.org To: pgsql-sql@postgresql.org Subject: Extract date from week References: <20051108065256.7DFE7D7971@svr1.postgresql.org> In-Reply-To: <20051108065256.7DFE7D7971@svr1.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0.3) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iracema.dnscenter.com.br X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [32001 502] / [47 12] X-AntiAbuse: Sender Address Domain - presserv.org X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.976 required=5 tests=[AWL=0.099, NO_REAL_NAME=0.55, RCVD_IN_NJABL_PROXY=0.327] X-Spam-Score: 0.976 X-Spam-Level: X-Archive-Number: 200511/67 X-Sequence-Number: 23318 Hi Looking the e-mail I remembered a question. I saw that "select extract (week from now()::date)" will return the week number of current year. But, how can I convert a week to the first reference date. Ex: select extract(week from '20050105'::date); -- 5 Jan 2005 --Returns-- date_part | 1 | It is the first week of year (2005), and how can I get what is the first date references the week 1? Ex: select ???? week 1 --should return--- date | 20050103 | -- 3 Jan 2005 Thank you. Lucas Vendramin