X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5D7CCD1D8AE for ; Mon, 16 Feb 2004 12:09:33 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 86561-06 for ; Mon, 16 Feb 2004 08:09:33 -0400 (AST) Received: from smtp105.mail.sc5.yahoo.com (smtp105.mail.sc5.yahoo.com [66.163.169.225]) by svr1.postgresql.org (Postfix) with SMTP id 74964D1B49E for ; Mon, 16 Feb 2004 08:09:29 -0400 (AST) Received: from unknown (HELO IVESIA67) (sgnerd@203.196.190.138 with login) by smtp105.mail.sc5.yahoo.com with SMTP; 16 Feb 2004 12:09:31 -0000 Message-ID: <00f701c3f485$d7091430$7502a8c0@hdsc.com> Reply-To: "Kumar" From: "Kumar" To: "psql" Subject: Getting the week of a date Date: Mon, 16 Feb 2004 17:40:08 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00F4_01C3F4B3.EBC0F2C0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=BAYES_44, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200402/193 X-Sequence-Number: 16883 This is a multi-part message in MIME format. ------=_NextPart_000_00F4_01C3F4B3.EBC0F2C0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear Friends, Postgres 7.3.4 on RH Linux7.2. While this works for month and why not for week test=3D# select date_trunc('month',current_date + ('5 month')::INTERVAL); date_trunc --------------------- 2004-07-01 00:00:00 (1 row) test=3D# select date_trunc('week',current_date + ('5 month')::INTERVAL); ERROR: TIMESTAMP units 'week' not supported test=3D# Any idea on how to find the 3 rd Wednesday of any given month.=20 Thanks Kumar ------=_NextPart_000_00F4_01C3F4B3.EBC0F2C0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear Friends,
 
Postgres 7.3.4 on RH Linux7.2.
 
While this works for month and why not for=20 week

test=3D# select date_trunc('month',current_date + ('5=20 month')::INTERVAL);
    =20 date_trunc
---------------------
 2004-07-01 00:00:00
(1=20 row)
 
test=3D# select date_trunc('week',current_date + ('5=20 month')::INTERVAL);
ERROR:  TIMESTAMP units 'week' not=20 supported
test=3D#
 
Any idea on how to find the 3 rd Wednesday of any given month.
 
Thanks
Kumar
 

------=_NextPart_000_00F4_01C3F4B3.EBC0F2C0--