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

From Scott Marlowe
Subject Re: First day of month, last day of month
Date
Msg-id dcc563d10804240755w612ec586l6bf8b0f4a805d49f@mail.gmail.com
Whole thread Raw
In response to Re: First day of month, last day of month  ("Nacef LABIDI" <nacef.l@gmail.com>)
Responses Re: First day of month, last day of month
List pgsql-sql
On Thu, Apr 24, 2008 at 8:43 AM, Nacef LABIDI <nacef.l@gmail.com> wrote:
> Actually I want to select all rows whith dates between first day of the
> month 00:00:00 and last date of the month 23:59:59

Then you can just use date_trunc on the values in the database. Plus
if you're using timestamp WITHOUT timezone, you can index on it.

create index table_datefield_month_trunc on table
(date_trunc('month',datefield));
select * from table where
date_trunc('month',timestampfield)='2007-10-01 00:00:00';


pgsql-sql by date:

Previous
From: Terry Lee Tucker
Date:
Subject: Re: First day of month, last day of month
Next
From: "Scott Marlowe"
Date:
Subject: Re: First day of month, last day of month