From: Jeff Boes <jboes@nexcerpt.com>
To: pgsql-sql@postgresql.org
Subject: Re: Calendar Function
Date: Thu, 03 Feb 2005 14:56:14 -0500
Message-ID: <cttvkv$114u$1@news.hub.org> (raw)
In-Reply-To: <018901c508d2$55bc3800$1f00a8c0@middinks>
References: <03a001c50545$6bd942d0$1f00a8c0@middinks>
<41FA5E6A.50002@akyasociados.com.ar>
<018901c508d2$55bc3800$1f00a8c0@middinks>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: jboes@nexcerpt.com
Subject: Re: Calendar Function
In-Reply-To: <cttvkv$114u$1@news.hub.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox