Re: Date manipulation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Date manipulation
Дата
Msg-id 14457.1082345105@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Date manipulation  (Hadley Willan <hadley.willan@deeperdesign.co.nz>)
Список pgsql-general
Hadley Willan <hadley.willan@deeperdesign.co.nz> writes:
> I take it I could just use ''now'' instead of a date
> dateRange = ''now''::date - ( 7 * '1 week'::interval );

You probably want to use the SQL-standard spelling:

  dateRange = current_date - ( 7 * '1 week'::interval );

Aside from being standard, this doesn't pose risk of the constant being
reduced sooner than you want.  The other way is likely to break if the
plpgsql function gets cached over more than a day.

            regards, tom lane

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Date manipulation
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Date manipulation