Re: Getting the week of a date

From: sad <sad(at)bankir(dot)ru>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Getting the week of a date
Date: 2004-02-16 13:23:24
Message-ID: 200402161623.24195.sad@bankir.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

EXCUSE ME, GUYS !

i forgot to add one monome:
7*(((to_char(date_trunc('month',now()),'D'))::INT2-1)/4)
which is stands for skip a first week of month in case it is not consist Wed

finally the select will be similar the following

SELECT 7*(((to_char(date_trunc('month',now()),'D'))::INT2-1)/4) + 1 -
(to_char(date_trunc('month',now()),'D'))::INT2 + 7*3-3 ;

4 - is a number of Wed in a week (in postgresql numeration)

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-02-16 15:34:18 Re: Date format problems
Previous Message sad 2004-02-16 13:08:52 Re: Getting the week of a date