X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 913BC8B9F32 for ; Thu, 3 Feb 2005 19:56:24 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 82680-06 for ; Thu, 3 Feb 2005 19:56:20 +0000 (GMT) Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.250.190.2]) by svr1.postgresql.org (Postfix) with ESMTP id C78C88B9E7F for ; Thu, 3 Feb 2005 19:56:20 +0000 (GMT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 6167C31DD1; Thu, 3 Feb 2005 20:56:20 +0100 (MET) From: Jeff Boes X-Newsgroups: pgsql.sql Subject: Re: Calendar Function Date: Thu, 03 Feb 2005 14:56:14 -0500 Organization: Hub.Org Networking Services Lines: 40 Message-ID: References: <03a001c50545$6bd942d0$1f00a8c0@middinks> <41FA5E6A.50002@akyasociados.com.ar> <018901c508d2$55bc3800$1f00a8c0@middinks> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en In-Reply-To: <018901c508d2$55bc3800$1f00a8c0@middinks> To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/76 X-Sequence-Number: 20187 Muhyiddin A.M Hayat wrote: > Ok, thanks > > But if i would like to display date in one Month, > > e.g : > date in feb 2005 You can do that in Pg date arithmetic: # select '1 oct 2004'::date + '1 month'::interval - '1 day'::interval; ?column? --------------------- 2004-10-31 00:00:00 (1 row) # select '1 nov 2004'::date + '1 month'::interval - '1 day'::interval; ?column? --------------------- 2004-11-30 00:00:00 (1 row) # select '1 feb 2004'::date + '1 month'::interval - '1 day'::interval; ?column? --------------------- 2004-02-29 00:00:00 (1 row) Thus, given the original response to your question: select * from calendar('1 feb 2004', ( '1 feb 2004'::date + '1 month'::interval - '1 day'::interval )::date); -- Jeff Boes vox 269.226.9550 ext 24 http://www.nexcerpt.com fax 269.349.9076 ...Nexcerpt... Extend your Expertise