Re: convert integer to interval ?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: convert integer to interval ?
Дата
Msg-id 13755.1044749306@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: convert integer to interval ?  ("Magnus Naeslund(f)" <mag@fbab.net>)
Список pgsql-general
"Magnus Naeslund(f)" <mag@fbab.net> writes:
> pilsl@goldfisch.at wrote:
>> something like
>> select current_timestamp+interval '7 days';

> Is there any reason why you can't do:

> sprintf(buf,"select current_timestamp+interval '%d days'",int_days);

Also, if you really only want the result to the nearest day, date
arithmetic (as opposed to timestamp arithmetic) works the way you want.
For example,

regression=# select current_date, current_date + 7;
    date    |  ?column?
------------+------------
 2003-02-08 | 2003-02-15
(1 row)


            regards, tom lane

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: convert integer to interval ?
Следующее
От: gearond@cvc.net
Дата:
Сообщение: How to do unique users