Обсуждение: how do i add a number of days to now()?

Поиск
Список
Период
Сортировка

how do i add a number of days to now()?

От
stig erikson
Дата:
hi.

i am trying to do something like:
insert into table (limitDate) VALUES( now() + 2 days);

my problem is, how do i make postgresql understand that i want to add 2
days to the current time?

the column limitDate is of the timestamp type.

thanks
stig

Re: how do i add a number of days to now()?

От
Michael Glaesemann
Дата:
On Dec 18, 2005, at 20:44 , stig erikson wrote:

> my problem is, how do i make postgresql understand that i want to
> add 2 days to the current time?

test=# select current_timestamp as "now"
    , current_timestamp + 2 * interval '1 day' as "2 days from now";
               now              |        2 days from now
-------------------------------+-------------------------------
2005-12-21 14:31:58.338283+09 | 2005-12-23 14:31:58.338283+09
(1 row)

Michael Glaesemann
grzm myrealbox com