Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id A3B042E003D for ; Thu, 24 Apr 2008 10:15:53 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 15622-09 for ; Thu, 24 Apr 2008 10:15:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.187]) by developer.postgresql.org (Postfix) with ESMTP id 5B1F92E0037 for ; Thu, 24 Apr 2008 10:15:50 -0300 (ADT) Received: from webserv.wug.de ([194.25.154.138]) by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis) id 0MKwh2-1Jp1IX3uG5-0007d7; Thu, 24 Apr 2008 15:15:44 +0200 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1Jp1IW-000677-00 for pgsql-sql@postgresql.org; Thu, 24 Apr 2008 15:15:36 +0200 Date: Thu, 24 Apr 2008 15:15:36 +0200 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: First day of month, last day of month Message-ID: <20080424131536.GC15397@a-kretschmer.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: Debian/GNU Linux - weil ich es mir Wert bin! User-Agent: Mutt/1.5.9i X-Provags-ID: V01U2FsdGVkX19iqYQp/dtyajQvMOKIKdjvXcibg7hwsb2SLgY SzIw7/Gt4Gz+zDD0RUgfl+ujN3nnPBLk0XiEejFqSAz91HZ1Zr nmwGNjqMSHDFzYfBM0/unhik0PoKJ77 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200804/152 X-Sequence-Number: 30691 am Thu, dem 24.04.2008, um 14:59:47 +0200 mailte Nacef LABIDI folgendes: > Hi all, > > I want to select data from a table according to a date column in my table. I > want to select all the rows which have date in the current month. So is there a > way to get from the actual date the first day and the last day of the month or test=*# select date_trunc('month', current_date), date_trunc('month', current_date)+'1month'::interval-'1day'::interval; date_trunc | ?column? ------------------------+------------------------ 2008-04-01 00:00:00+02 | 2008-04-30 00:00:00+02 -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net