Re: function to find last day of month
От
Тема
Re: function to find last day of month
Дата
Msg-id
64763.216.238.112.88.1070631133.squirrel@$HOSTNAME
Ответ на
function to find last day of month (Jennifer Lee)
Список
Дерево обсуждения
function to find last day of month "Jennifer Lee" <jlee@scri.sari.ac.uk>
Re: function to find last day of month <btober@seaworthysys.com>
Re: function to find last day of month Pavel Stehule <stehule@kix.fsv.cvut.cz>
> Hello, > > Does anyone happen to have a function, prefereably in pl/pgsql, which > given the month and year will return the last day in that month? > Something like this might get you started: CREATE OR REPLACE FUNCTION public.fom(date) RETURNS date AS ' SELECT COALESCE($1, CURRENT_DATE)-EXTRACT(DAY FROM COALESCE($1, CURRENT_DATE))::INTEGER+1; ' LANGUAGE 'sql' VOLATILE; CREATE OR REPLACE FUNCTION public.lom(date) RETURNS date AS ' SELECT fom(date (COALESCE($1, CURRENT_DATE) + interval \'1 month\'))-1; ' LANGUAGE 'sql' VOLATILE; ~Berend Tober
В списке pgsql-general по дате отправления