Re: Calendar Function
| От | Jeff Boes |
|---|---|
| Тема | Re: Calendar Function |
| Дата | |
| Msg-id | cttvkv$114u$1@news.hub.org обсуждение |
| Ответ на | Re: Calendar Function ("Muhyiddin A.M Hayat" <middink@indo.net.id>) |
| Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: