pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Henrik Pedersen <HenrikP@utp.dk>
To: pgsql-sql@postgresql.org
Subject: How to compare Datetime
Date: Fri, 16 Apr 1999 12:38:13 -0400 (EDT)
Message-ID: <3718111689.8543HENRIKP@mail.ikasths.dk> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <3718111689.8543HENRIKP@mail.ikasths.dk>
Permalink:  ../3718111689.8543HENRIKP@mail.ikasths.dk/
Also on:    postgresql.org/message-id/3718111689.8543HENRIKP@mail.ikasths.dk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: HenrikP@utp.dk
  Subject: Re: How to compare Datetime
  In-Reply-To: <3718111689.8543HENRIKP@mail.ikasths.dk>
  References: <3718111689.8543HENRIKP@mail.ikasths.dk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox