[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-sql
Subject:    [SQL] Year of the week : How to ?
From:       "Emmanuel Guyot" <emmguyot () wanadoo ! fr>
Date:       2002-08-27 9:52:46
[Download RAW message or body]

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



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic