Re: First day of month, last day of month - Mailing list pgsql-sql

From Frank Bax
Subject Re: First day of month, last day of month
Date
Msg-id 48108813.6070401@sympatico.ca
Whole thread Raw
In response to Re: First day of month, last day of month  (Frank Bax <fbax@sympatico.ca>)
Responses Re: First day of month, last day of month  (Colin Wetherbee <cww@denterprises.org>)
List pgsql-sql
Frank Bax wrote:
> 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());


Sorry; I was not thinking clearly - date_trunc is better for this:

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


pgsql-sql by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: First day of month, last day of month
Next
From: "Anoop G"
Date:
Subject: How I can check a substring is a valid number in postgresql ?