Search Postgresql Archives

Re: Date manipulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux