From: Scott Marlowe <scott.marlowe@gmail.com>
To: Nacef LABIDI <nacef.l@gmail.com>
Cc: Colin Wetherbee <cww@denterprises.org>
Cc: Frank Bax <fbax@sympatico.ca>
Cc: pgsql-sql@postgresql.org
Subject: Re: First day of month, last day of month
Date: Thu, 24 Apr 2008 08:55:31 -0600
Message-ID: <dcc563d10804240755w612ec586l6bf8b0f4a805d49f@mail.gmail.com> (raw)
In-Reply-To: <f16f7ea00804240743la32b08cm6ced0d9ced56948a@mail.gmail.com>
References: <f16f7ea00804240559y6694c19fx102e57ea4455b07d@mail.gmail.com>
<481085D1.2010807@sympatico.ca>
<48108813.6070401@sympatico.ca>
<481095FB.7090600@denterprises.org>
<f16f7ea00804240743la32b08cm6ced0d9ced56948a@mail.gmail.com>
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';
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: scott.marlowe@gmail.com, nacef.l@gmail.com, cww@denterprises.org, fbax@sympatico.ca
Subject: Re: First day of month, last day of month
In-Reply-To: <dcc563d10804240755w612ec586l6bf8b0f4a805d49f@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox