pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: lucas@presserv.org
To: pgsql-sql@postgresql.org
Subject: Extract date from week
Date: Tue, 08 Nov 2005 08:25:11 -0300
Message-ID: <20051108082511.06n26rf2fc0gk8cg@www.presserv.org> (raw)
In-Reply-To: <20051108065256.7DFE7D7971@svr1.postgresql.org>
References: <20051108065256.7DFE7D7971@svr1.postgresql.org>

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




view thread (3+ messages)  latest in thread

Message-ID: <20051108082511.06n26rf2fc0gk8cg@www.presserv.org>
Permalink:  ../20051108082511.06n26rf2fc0gk8cg@www.presserv.org/
Also on:    postgresql.org/message-id/20051108082511.06n26rf2fc0gk8cg@www.presserv.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: lucas@presserv.org
  Subject: Re: Extract date from week
  In-Reply-To: <20051108082511.06n26rf2fc0gk8cg@www.presserv.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