Skip site navigation (1) Skip section navigation (2)

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$ (view raw, whole thread or download thread mbox)
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);
 2004-07-01 00:00:00
(1 row)

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

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



pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group