X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 15C069DCA74 for ; Tue, 20 Dec 2005 11:05:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 96285-09 for ; Tue, 20 Dec 2005 11:05:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 5251F9DCA21 for ; Tue, 20 Dec 2005 11:05:36 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id jBKF5brY029115; Tue, 20 Dec 2005 10:05:37 -0500 (EST) To: Michael Burke cc: pgsql-sql@postgresql.org, aarni@kymi.com Subject: Re: Querying date_time for date only ? In-reply-to: <200512200919.49986.michael@engtech.ca> References: <200512201459.07358.aarni@kymi.com> <200512200919.49986.michael@engtech.ca> Comments: In-reply-to Michael Burke message dated "Tue, 20 Dec 2005 09:19:49 -0400" Date: Tue, 20 Dec 2005 10:05:37 -0500 Message-ID: <29114.1135091137@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.019 required=5 tests=[AWL=0.019] X-Spam-Score: 0.019 X-Spam-Level: X-Archive-Number: 200512/178 X-Sequence-Number: 23720 Michael Burke writes: > On December 20, 2005 08:59 am, Aarni Ruuhimäki wrote: >> I have a time stamp without time zone field, YYYY-MM-DD hh:mm:ss, in my >> table. I want to also find something just for a particular day regardless >> of the time. > You can try, > SELECT field::date FROM mytable; The date_trunc() function can also be useful for this sort of thing, particularly if you need to round off to something finer or coarser than days. http://www.postgresql.org/docs/8.1/static/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC regards, tom lane