Re: [GENERAL] get first / last date of given week

2004-07-21 Thread Lee Harr
Have a look at this simpler non looping version of week_start() That is a nice idea. I had to modify it a bit in order to get the same answers as my other function ... CREATE or REPLACE FUNCTION week_start2(integer, integer) RETURNS date AS ' DECLARE pyear ALIAS FOR $1; pweek

Re: [GENERAL] get first / last date of given week

2004-07-17 Thread Jean-Luc Lachance
Lee, Have a look at this simpler non looping version of week_start() -- return the first date in the given week CREATE or REPLACE FUNCTION week_start(integer, integer) RETURNS date LANGUAGE 'plpgsql' AS ' DECLARE pyear ALIAS FOR $1; pweek ALIAS FOR $2; year_start date; week_interval