X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 117A3D1B4D7 for ; Wed, 10 Dec 2003 15:53:05 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 69010-03 for ; Wed, 10 Dec 2003 11:52:38 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id CDE3FD1B4CC for ; Wed, 10 Dec 2003 11:52:28 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id hBAFpn19006553; Wed, 10 Dec 2003 10:51:49 -0500 (EST) To: "sqllist" Cc: pgsql-sql@postgresql.org, jeff@dnuk.com Subject: Re: How to specify the beginning of the month in Postgres SQL syntax? In-reply-to: <002101c3bede$ed1e29e0$0f32a8c0@denisnew> References: <002101c3bede$ed1e29e0$0f32a8c0@denisnew> Comments: In-reply-to "sqllist" message dated "Wed, 10 Dec 2003 11:01:54 +0530" Date: Wed, 10 Dec 2003 10:51:48 -0500 Message-ID: <6552.1071071508@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/84 X-Sequence-Number: 16250 "sqllist" 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