Getting the week of a date

From: "Kumar" <sgnerd(at)yahoo(dot)com(dot)sg>
To: "psql" <pgsql-sql(at)postgresql(dot)org>
Subject: Getting the week of a date
Date: 2004-02-16 12:10:08
Message-ID: 00f701c3f485$d7091430$7502a8c0@hdsc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear Friends,

Postgres 7.3.4 on RH Linux7.2.

While this works for month and why not for week

test=# select date_trunc('month',current_date + ('5 month')::INTERVAL);
date_trunc
---------------------
2004-07-01 00:00:00
(1 row)

test=# select date_trunc('week',current_date + ('5 month')::INTERVAL);
ERROR: TIMESTAMP units 'week' not supported
test=#

Any idea on how to find the 3 rd Wednesday of any given month.

Thanks
Kumar

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Robert Creager 2004-02-16 12:43:20 Re: Getting the week of a date
Previous Message Denis 2004-02-16 08:57:54 Re: max timestamp