Re: function to find last day of month

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: function to find last day of month
Дата
Msg-id Pine.LNX.4.44.0312051353250.6885-100000@kix.fsv.cvut.cz
обсуждение исходный текст
Ответ на function to find last day of month  ("Jennifer Lee" <jlee@scri.sari.ac.uk>)
Список pgsql-general
Hello

try:

CREATE OR REPLACE FUNCTION LastDateOfMonth(date) RETURNS date AS '
  SELECT CAST(date_trunc(''month'', $1) + interval ''1 month''
    - interval ''1 day'' as date);
' LANGUAGE sql;

Regards
Pavel

On Fri, 5 Dec 2003, Jennifer Lee wrote:

> 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?
>
> Thanks,
> Jennifer
>
>
> *****************************************************************
> DISCLAIMER:
>
> This email is from the Scottish Crop Research Institute, but the views expressed by the sender are not necessarily
theviews of SCRI and its subsidiaries.  This email and any files transmitted with it are confidential to the intended
recipientat the e-mail address to which it has been addressed.  It may not be disclosed or used by any other than that
addressee.
> If you are not the intended recipient you are requested to preserve this confidentiality and you must not use,
disclose,copy, print or rely on this e-mail in any way. Please notify mail@scri.sari.ac.uk quoting the name of the
senderand delete the email from your system. 
>
> Although SCRI has taken reasonable precautions to ensure no viruses are present in this email, neither the Institute
northe sender accepts any responsibility for any viruses, and it is your responsibility to scan the email and the
attachments(if any). 
>
>
>


В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: Money data type in PostgreSQL?
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: ecpg -e