Re: Previous month function

From: Aleksander Kmetec <aleksander(dot)kmetec(at)intera(dot)si>
To: mbaluyos(at)sni(dot)ph
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Previous month function
Date: 2004-11-17 11:34:38
Message-ID: 419B374E.1020105@intera.si
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.
>

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Glaesemann 2004-11-17 11:36:16 Re: [OT] apache auth with postgres?
Previous Message Marcin Gil 2004-11-17 11:17:32 Re: [OT] apache auth with postgres?