pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Emmanuel Guyot <emmguyot@wanadoo.fr>
To: pgsql-sql@postgresql.org
Subject: Year of the week : How to ?
Date: Tue, 27 Aug 2002 11:52:46 +0200
Message-ID: <akfi5c$23i1$1@news.hub.org> (raw)

How to retrieve the year based on week of a date ?

If I use datepart('year', aDate), I get the year of the date.
If I use datepart('week', aDate), I get the week of the date.
But these aren't corelated. So when aDate is Dec 31st 2001, I get 2001, and
the week is 1. I'd like to have 2002 for the year in this case.

Is there a simple way to do this ?

Emmanuel Guyot
8 Rue des Montées
45100 Orléans
Web site : http://www.increg.com





Message-ID: <akfi5c$23i1$1@news.hub.org>
Permalink:  ../akfi5c$23i1$1@news.hub.org/
Also on:    postgresql.org/message-id/akfi5c$23i1$1@news.hub.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: emmguyot@wanadoo.fr
  Subject: Re: Year of the week : How to ?
  In-Reply-To: <akfi5c$23i1$1@news.hub.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