How to compare Datetime
От | Henrik Pedersen |
---|---|
Тема | How to compare Datetime |
Дата | |
Msg-id | 3718111689.8543HENRIKP@mail.ikasths.dk обсуждение исходный текст |
Список | pgsql-sql |
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
В списке pgsql-sql по дате отправления: