X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3CE45D1B44E for ; Mon, 22 Mar 2004 11:34:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 57473-02 for ; Mon, 22 Mar 2004 07:34:49 -0400 (AST) Received: from bugs.unl.edu.ar (bugs.unl.edu.ar [168.96.132.208]) by svr1.postgresql.org (Postfix) with ESMTP id EB713D1DD0F for ; Mon, 22 Mar 2004 07:34:40 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id 9E82A11E7B; Mon, 22 Mar 2004 08:32:35 -0300 (ART) Received: from bugs.unl.edu.ar ([127.0.0.1]) by localhost (bugs [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 06165-04; Mon, 22 Mar 2004 08:32:35 -0300 (ART) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id BFD5811DE7; Mon, 22 Mar 2004 08:32:34 -0300 (ART) From: Martin Marques To: Tom Lane , Robert Creager Subject: Re: inverse of "day of year" Date: Mon, 22 Mar 2004 08:32:32 -0300 User-Agent: KMail/1.5.4 Cc: pgsql-sql@postgresql.org References: <200403190906.17641.martin@bugs.unl.edu.ar> <20040319064714.405b304e.Robert_Creager@LogicalChaos.org> <24189.1079709005@sss.pgh.pa.us> In-Reply-To: <24189.1079709005@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200403220832.32968.martin@bugs.unl.edu.ar> X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at unl.edu.ar X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/213 X-Sequence-Number: 17312 El Vie 19 Mar 2004 12:10, Tom Lane escribi=F3: > Robert Creager writes: > > Martin Marques confessed: > >> Is there a function that would give me the date for a given day of yea= r? > > > > Something like: > > > > select date_trunc( 'year', now() ) + (extract( doy from now() ) - 1) * > > '1day'::interval; > > timestamp + interval arithmetic is likely to give you problems at > daylight savings boundaries, since '1day' will be taken as '24hours'. Is there information on how other intervals are taken? I mean, how is '1 ye= ar'=20 afected with the leap years? --=20 08:30:01 up 13 days, 13:01, 3 users, load average: 2.04, 1.80, 1.04 ----------------------------------------------------------------- Mart=EDn Marqu=E9s | select 'mmarques' || '@' || 'unl.edu.ar' Centro de Telematica | DBA, Programador, Administrador Universidad Nacional del Litoral -----------------------------------------------------------------