From: Tom Lane <tgl@sss.pgh.pa.us>
To: sqllist <sqllist@coralindia.com>
Cc: pgsql-sql@postgresql.org
Cc: jeff@dnuk.com
Subject: Re: How to specify the beginning of the month in Postgres SQL syntax?
Date: Wed, 10 Dec 2003 10:51:48 -0500
Message-ID: <6552.1071071508@sss.pgh.pa.us> (raw)
In-Reply-To: <002101c3bede$ed1e29e0$0f32a8c0@denisnew>
References: <t6k6tv8unr1dm7kpeb275ca0t9in2i910h@4ax.com>
<002101c3bede$ed1e29e0$0f32a8c0@denisnew>
"sqllist" <sqllist@coralindia.com> writes:
> WHERE date < to_date( to_char(current_date,'yyyy-MM') || '-01','yyyy-mm-dd')
That seems like the hard way. Try this:
regression=# select date_trunc('month', now());
date_trunc
------------------------
2003-12-01 00:00:00-05
(1 row)
regards, tom lane
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: tgl@sss.pgh.pa.us, sqllist@coralindia.com, jeff@dnuk.com
Subject: Re: How to specify the beginning of the month in Postgres SQL syntax?
In-Reply-To: <6552.1071071508@sss.pgh.pa.us>
* 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