Re: Date manipulation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Date manipulation
Дата
Msg-id 15231.1082349778@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Date manipulation  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: Date manipulation  (Hadley Willan <hadley.willan@deeperdesign.co.nz>)
Список pgsql-general
Bruno Wolff III <bruno@wolff.to> writes:
>   Hadley Willan <hadley.willan@deeperdesign.co.nz> wrote:
>> dateRange = ''now''::date - ( 7 * '1 week'::interval );

> If you actually are using a date you don't have to use an interval as
> the number subtracted will be in days. So you could just use
> current_date - (7 * 7);

Good point --- in fact, that's probably exactly what Hadley wants,
because "date - integer" will yield a date and not a timestamp.  The
form involving interval will do odd things when crossing a DST
transition.

            regards, tom lane

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

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