Re: Date manipulation

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Hadley Willan <hadley(dot)willan(at)deeperdesign(dot)co(dot)nz>
Cc: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>, PGSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Date manipulation
Date: 2004-04-19 03:27:48
Message-ID: 20040419032748.GC1881@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 19, 2004 at 11:18:23 +1200,
Hadley Willan <hadley(dot)willan(at)deeperdesign(dot)co(dot)nz> wrote:
> Thanks, that's pretty easy.
>
> I take it I could just use ''now'' instead of a date
>
> 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);

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-04-19 04:42:58 Re: Date manipulation
Previous Message Tom Lane 2004-04-19 03:25:05 Re: Date manipulation