Re: Help With date/time - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: Help With date/time
Date
Msg-id 20031108172854.GA22452@wolff.to
Whole thread Raw
In response to Help With date/time  (Alex <alex@meerkatsoft.com>)
List pgsql-general
On Sun, Nov 09, 2003 at 02:04:22 +0900,
  Alex <alex@meerkatsoft.com> wrote:
> Hi,
> I want to remove data that is older that a certain number of months..
> only full months.

One approach would be to get the year, month and day as numbers from
the current date. Then change the day to 1 and subtract 3 from the
month (borrowing 1 from the year if necessary) and then use these
numbers to build the date you want to test against.

>
> example: today is 11-08 and I want do delete all data that is older than
> this month - 3 month i.e. i want to delete all information that is older
> than Aug. 1st.
>
> Is there an easy way to do that ? Interval cannot be used and I cannot
> just pass something like now()::date < '2003-08'
>
> Thanks for any help here
> Alex
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

pgsql-general by date:

Previous
From: Alex
Date:
Subject: Help With date/time
Next
From: Jan Wieck
Date:
Subject: Re: int8 primary keys still not using index without manual