Re: [GENERAL] getting last day of month

2005-08-25 Thread Chris Browne
[EMAIL PROTECTED] (Sergey Pariev) writes: > I need to find out the last day of current month. Currently I do the > trick with code below, but that's rather ugly way to do it IMHO. Could > anybody suggest me a better way ? log_analysis=# select date_trunc('months', (date_trunc('months', now()) + '

Re: [GENERAL] getting last day of month

2005-08-25 Thread Patrick . FICHE
9 29 36 18 --- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Sergey Pariev Sent: jeudi 25 aout 2005 18:44 To: pgsql-general postgresql.org Subject: [GENERAL] getting last day of month Hi all. I need t

Re: [GENERAL] getting last day of month

2005-08-25 Thread Tino Wildenhain
Sergey Pariev schrieb: Hi all. I need to find out the last day of current month. Currently I do the trick with code below, but that's rather ugly way to do it IMHO. Could anybody suggest me a better way ? The following is my testing procedure : CREATE or REPLACE FUNCTION test_findout_dates()

Re: [GENERAL] getting last day of month

2005-08-25 Thread josue
Sergey, Try this one: CREATE OR REPLACE FUNCTION public.lastdayofmonth(date) RETURNS date AS ' select ((date_trunc(\'month\', $1) + interval \'1 month\') - interval \'1 day\')::date; ' LANGUAGE 'sql' VOLATILE; Sergey Pariev wrote: Hi all. I need to find out the last day of current mon

Re: [GENERAL] getting last day of month

2005-08-25 Thread Sergey Moiseev
Sergey Pariev wrote: > Hi all. > I need to find out the last day of current month. Currently I do the > trick with code below, but that's rather ugly way to do it IMHO. Could > anybody suggest me a better way ? select '2005-09-01'::date-'1 day'::interval does the trick :) -- Wbr, Sergey Moiseev -

[GENERAL] getting last day of month

2005-08-25 Thread Sergey Pariev
Hi all. I need to find out the last day of current month. Currently I do the trick with code below, but that's rather ugly way to do it IMHO. Could anybody suggest me a better way ? The following is my testing procedure : CREATE or REPLACE FUNCTION test_findout_dates() RETURNS integer AS $$ D