Re: inverse of "day of year"

From: Robert Creager <Robert_Creager(at)LogicalChaos(dot)org>
To: Martin Marques <martin(at)bugs(dot)unl(dot)edu(dot)ar>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: inverse of "day of year"
Date: 2004-03-19 13:47:14
Message-ID: 20040319064714.405b304e.Robert_Creager@LogicalChaos.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--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(at)bugs(dot)unl(dot)edu(dot)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--

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Devrim GUNDUZ 2004-03-19 14:23:10 Re: psql: FATAL 1: IDENT authentication failed for user error
Previous Message Martin Marques 2004-03-19 13:05:40 Re: psql: FATAL 1: IDENT authentication failed for user error - Urgent pls