Re: [SQL] Calendar Function

2005-02-03 Thread Jeff Boes
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) # selec

Re: [SQL] Calendar Function

2005-02-01 Thread Michael Fuhr
On Wed, Feb 02, 2005 at 10:53:09AM +0800, Muhyiddin A.M Hayat wrote: > > But if i would like to display date in one Month, You could use the given function with a few changes. For example, given an arbitrary date, you could use date_trunc() to find the first day of that date's month, add an inte

Re: [SQL] Calendar Function

2005-02-01 Thread Bradley Miller
You might need to get creative and do some functionality in another language, like C or PHP via the PL integration. (I know I just saw something for PHP . . . the question is can you use PHP functions ? ? ) On Feb 1, 2005, at 8:53 PM, Muhyiddin A.M Hayat wrote: Ok, thanks   But if i would li

Re: [SQL] Calendar Function

2005-02-01 Thread Muhyiddin A.M Hayat
: pgsql-sql@postgresql.org Sent: Friday, January 28, 2005 11:46 PM Subject: Re: [SQL] Calendar Function maybe somthing like this:CREATE OR REPLACE FUNCTION calendar (DATE, DATE) RETURNS SETOF DATE LANGUAGE 'plpgsql' AS 'DECLARE    v_from ALIAS FOR $1;    v_to ALIAS FOR $

Re: [SQL] Calendar Function

2005-01-28 Thread Franco Bruno Borghesi
maybe somthing like this: CREATE OR REPLACE FUNCTION calendar (DATE, DATE) RETURNS SETOF DATE LANGUAGE 'plpgsql' AS ' DECLARE     v_from ALIAS FOR $1;     v_to ALIAS FOR $2;     v_current DATE DEFAULT v_from; BEGIN     WHILE (v_current<=v_to) LOOP         RETURN NEXT v_current;         v_curr