Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [206.210.65.6]) by hub.org (8.9.2/8.9.1) with ESMTP id LAA37529 for ; Sat, 17 Apr 1999 11:47:04 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id LAA23588; Sat, 17 Apr 1999 11:46:32 -0400 (EDT) To: Henrik Pedersen cc: pgsql-sql@hub.org Subject: Re: [SQL] How to compare Datetime In-reply-to: Your message of Fri, 16 Apr 1999 23:00:02 -0400 (EDT) <199904170300.XAA59609@hub.org> Date: Sat, 17 Apr 1999 11:46:31 -0400 Message-ID: <23586.924363991@sss.pgh.pa.us> From: Tom Lane Henrik Pedersen writes: > Im having some problems with the datetime fields datetime is a date and time, not just a date. The behavior you describe is all perfectly correct once you realize that your constants are being interpreted as midnight of the given date. If you only want to store the date, and not the time of day, your column datatype should be "date" not datetime. If you do want to store an exact time, then datetime is the right thing to use. You can perform tests on it with one-day resolution by using the date_part function to extract just the date. See the User's Guide. regards, tom lane