Re: Previous month function - Mailing list pgsql-novice

From Tom Lane
Subject Re: Previous month function
Date
Msg-id 11614.1100705241@sss.pgh.pa.us
Whole thread Raw
In response to Re: Previous month function  (Aleksander Kmetec <aleksander.kmetec@intera.si>)
List pgsql-novice
Aleksander Kmetec <aleksander.kmetec@intera.si> writes:
> You can do something like this:

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

Also, depending on just what you meant by "previous month", you might
want to apply date_trunc():

regression=# select date_trunc('month', NOW()) - '1 month'::interval;
        ?column?
------------------------
 2004-10-01 00:00:00-04
(1 row)


            regards, tom lane

pgsql-novice by date:

Previous
From: "Vishal Kashyap @ [SaiHertz]"
Date:
Subject: Re: upgrade from postgres 7.3.2
Next
From: sarlav kumar
Date:
Subject: subscribe for a digest fails