pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Creager <Robert_Creager@LogicalChaos.org>
To: Martin Marques <martin@bugs.unl.edu.ar>
Cc: pgsql-sql@postgresql.org
Subject: Re: inverse of "day of year"
Date: Fri, 19 Mar 2004 06:47:14 -0700
Message-ID: <20040319064714.405b304e.Robert_Creager@LogicalChaos.org> (raw)
In-Reply-To: <200403190906.17641.martin@bugs.unl.edu.ar>
References: <200403190906.17641.martin@bugs.unl.edu.ar>

--Multipart_Fri__19_Mar_2004_06_47_14_-0700_=.EA)'AQ9a)11MwN
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

When grilled further on (Fri, 19 Mar 2004 09:06:17 -0300),
Martin Marques <martin@bugs.unl.edu.ar> confessed:

> Is there a function that would give me the date for a given day of year?
> 
> Something like the inverse of "EXTRACT(doy FROM date)"?
> 

Something like:

select date_trunc( 'year', now() ) + (extract( doy from now() ) - 1) *
'1day'::interval;

Later,
Rob

-- 
 06:46:54 up 8 days,  9:58,  2 users,  load average: 2.00, 2.11, 2.09
Linux 2.4.21-0.13_test #60 SMP Sun Dec 7 17:00:02 MST 2003

--Multipart_Fri__19_Mar_2004_06_47_14_-0700_=.EA)'AQ9a)11MwN
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iEYEARECAAYFAkBa+e0ACgkQLQ/DKuwDYzkwAACgl0JtSw9BnP8DI6mR02VYohQI
vbIAoJQ6nqhybHGfkZdficy655VRiHbN
=9StM
-----END PGP SIGNATURE-----

--Multipart_Fri__19_Mar_2004_06_47_14_-0700_=.EA)'AQ9a)11MwN--




view thread (9+ messages)  latest in thread

Message-ID: <20040319064714.405b304e.Robert_Creager@LogicalChaos.org>
Permalink:  ../20040319064714.405b304e.Robert_Creager@LogicalChaos.org/
Also on:    postgresql.org/message-id/20040319064714.405b304e.Robert_Creager@LogicalChaos.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Robert_Creager@LogicalChaos.org, martin@bugs.unl.edu.ar
  Subject: Re: inverse of "day of year"
  In-Reply-To: <20040319064714.405b304e.Robert_Creager@LogicalChaos.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox