Problem with date calculation

Поиск
Список
Период
Сортировка
От Patrick FICHE
Тема Problem with date calculation
Дата
Msg-id 85058ADF852DD5118FD50002A528A5B6079A14@SERVEUR
обсуждение исходный текст
Ответы Re: Problem with date calculation  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-general
Hi,

I'm a newbie to Postgresql and have a problem manipulating dates in a
function...

In fact, I want a function to add some days to the current date and return
the result date.

My code would be something like :

/***************************************************************************
*********/
CREATE OR REPLACE FUNCTION AddDay( int ) RETURNS timestamp AS '

DECLARE
_INTdays ALIAS FOR $1;

_DTcurrent timestamp;

BEGIN

_DTcurrent := NOW() + interval ''_INTdays days'';
RETURN _DTcurrent;

END'
LANGUAGE 'plpgsql';
/***************************************************************************
*********/

I know there is an error in the date calculation but don't know how to
calculate it....

Thanks for your help.

Patrick Fiche



Patrick Fiche
email : patrick.fiche@aqsacom.com
tél : 01 69 29 36 18


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Permissions for system tables
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: Problem with date calculation