Re: First day of month, last day of month

From: "Bart Degryse" <Bart(dot)Degryse(at)indicator(dot)be>
To: <pgsql-sql(at)postgresql(dot)org>, "Frank Bax" <fbax(at)sympatico(dot)ca>
Subject: Re: First day of month, last day of month
Date: 2008-04-24 13:11:03
Message-ID: 4810A306.A3DD.0030.0@indicator.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

select * from mytable where date_trunc('month', mydate) = date_trunc('month', now());

>>> Frank Bax <fbax(at)sympatico(dot)ca> 2008-04-24 15:06 >>>
Nacef LABIDI wrote:
> is there a better method to retrieve all
> the rows with dates in the current month.

select * from mytable where extract(month from mydate) = extract(month
from now()) and extract(year from mydate) = extract(year from now());

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2008-04-24 13:15:36 Re: First day of month, last day of month
Previous Message Frank Bax 2008-04-24 13:06:25 Re: First day of month, last day of month