Re: Previous month function - Mailing list pgsql-novice

From Aleksander Kmetec
Subject Re: Previous month function
Date
Msg-id 419B374E.1020105@intera.si
Whole thread Raw
In response to Previous month function  ("Matt Arnilo S. Baluyos" <mbaluyos@sni.ph>)
Responses Re: Previous month function  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
You can do something like this:

test=> select NOW() - '1 month'::interval;
            ?column?
-------------------------------
  2004-10-17 12:31:09.944818+02


Simply replace NOW() with your timestamp column.

Regards,
Aleksander



Matt Arnilo S. Baluyos wrote:
> hello everyone,
>
> is there already a built-in function that returns the previous month from the
> current timestamp? (and includes functionality to turn back one year if
> current month is january)
>
> i don't want to reinvent the wheel but if there's none then i guess i would
> just have to make one from scratch.
>

pgsql-novice by date:

Previous
From: "Marcin Gil"
Date:
Subject: Re: [OT] apache auth with postgres?
Next
From: Michael Glaesemann
Date:
Subject: Re: [OT] apache auth with postgres?