Received: from mail.ikasths.dk (mail.ikasths.dk [194.182.53.3]) by hub.org (8.9.2/8.9.1) with ESMTP id MAA93072 for ; Fri, 16 Apr 1999 12:38:13 -0400 (EDT) (envelope-from HenrikP@utp.dk) Date: Fri, 16 Apr 1999 12:38:13 -0400 (EDT) Received: from da_pc140 ([194.182.53.200]) by mail.ikasths.dk (Post.Office MTA v3.5.2 release 221 ID# 0-56697U2000L200S0V35) with SMTP id dk for ; Fri, 16 Apr 1999 18:38:25 +0000 From: Henrik Pedersen To: pgsql-sql@postgresql.org Subject: How to compare Datetime Message-Id: <3718111689.8543HENRIKP@mail.ikasths.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver 1.24 (beta 4) Hi... Im having some problems with the datetime fields Here is an example: +----------------------------------+----------------------------------+-------+ | Field | Type | Length| +----------------------------------+----------------------------------+-------+ | id | int4 | 4 | | fornavn | text | var | | tilmelddato | datetime | 8 | +----------------------------------+----------------------------------+-------+ I want to select the entries that came in to the database 15 days ago. tilmelddato contains the date that the entry was entered. I do a "select * from testtable where tilmelddato = '01/04/1999'" but that doesn't return anything even though my database contains 2 entries for that day. If a do a "select * from testtable where tilmelddato > '01/04/1999'" it returns 6 hits, but 2 of the hits was entered on the 01/04/1999 and should not be in there, because of the >. But if i use the < sign it works as i should. But if i do this: "Select * from testtable where tilmelddato <= '15/04/1999'" the records with 15/04/1999 is NOT included in the result set. Im a bit confused about this .. the = dosnt work, the > and < works partly Im running Redhat 5.2 with kernel 2.2.4 and postgresql-6.4.2 Hope someone out there knows the answer :) With friendly regards Henrik Pedersen Denmark