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 92A9F9DCA58 for ; Tue, 20 Dec 2005 09:33:44 -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 76203-02 for ; Tue, 20 Dec 2005 09:33:46 -0400 (AST) X-Greylist: delayed 00:34:33.2694 by SQLgrey- Received: from smtp10.kymp.net (smtp10.kymp.net [80.248.96.136]) by postgresql.org (Postfix) with ESMTP id 8995F9DCA74 for ; Tue, 20 Dec 2005 09:33:40 -0400 (AST) Received: from [192.168.0.100] (static-241-66.kymp.net [213.130.241.66]) by smtp10.kymp.net (8.13.3/8.13.3) with SMTP id jBKDXhPL005911 for ; Tue, 20 Dec 2005 15:33:43 +0200 From: Aarni =?iso-8859-1?q?Ruuhim=E4ki?= Reply-To: aarni@kymi.com Organization: KYMI.com To: pgsql-sql@postgresql.org Subject: Re: Querying date_time for date only ? Date: Tue, 20 Dec 2005 15:33:42 +0200 User-Agent: KMail/1.6.2 References: <200512201459.07358.aarni@kymi.com> <200512200919.49986.michael@engtech.ca> In-Reply-To: <200512200919.49986.michael@engtech.ca> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <200512201533.42043.aarni@kymi.com> X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.222 required=5 tests=[AWL=0.222] X-Spam-Score: 0.222 X-Spam-Level: X-Archive-Number: 200512/174 X-Sequence-Number: 23716 On Tuesday 20 December 2005 15:19, Michael Burke wrote: > On December 20, 2005 08:59 am, Aarni Ruuhim=E4ki wrote: > > Hello List, > > > > 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 regardle= ss > > of the time. > > > > (Pg)SQL way to do this ? > > You can try, > > SELECT field::date FROM mytable; > > to select only the date part. Likewise, you can use field::time if you > want to disregard the date. > That's neat, thanks.=20 I was just getting there with WHERE ... AND EXTRACT('day' FROM res_date_time) =3D $day=20 AND EXTRACT('month' FROM res_date_time) =3D $month AND ..., which may be useful elsewhere. > > TIA, > > > > Aarni > > HTH. > Mike. Merry Christmas to everyone, Aarni