Received: from BigPenguin.inet.cz (IDENT:root@bigpenguin.inet.cz [62.229.34.227]) by hub.org (8.9.3/8.9.3) with ESMTP id RAA75716 for ; Mon, 28 Jun 1999 17:45:55 -0400 (EDT) (envelope-from makub@inet.cz) Received: from inet.cz (mozart.local [10.0.0.38]) by BigPenguin.inet.cz (8.9.3/8.9.3) with ESMTP id XAA11000 for ; Mon, 28 Jun 1999 23:49:46 +0200 Message-ID: <3777ED6B.52E679AB@inet.cz> Date: Mon, 28 Jun 1999 23:47:23 +0200 From: Martin Kuba X-Mailer: Mozilla 4.6 [en] (WinNT; I) X-Accept-Language: cs,en MIME-Version: 1.0 To: "pgsql-interfaces@postgreSQL.org" Subject: bug in storing date ? Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Hi, I have a problem with storing date. I have Postgresql6.4.2 and Java1.2 on Linux. This is my code for inserting date to column of type "date": SimpleDateFormat df = new SimpleDateFormat ("dd.MM.yyyy"); ParsePosition pos = new ParsePosition(0); java.util.Date udate = df.parse("18.06.1999",pos); java.sql.Date sdate = new java.sql.Date(udate.getTime()); ... PreparedStatement pstmt = con.prepareStatement ("INSERT INTO mytable VALUES(?)"); pstmt.setDate(1,sdate); pstmt.executeUpdate(); The problem is, that I want to insert the date "18.06.1999" but I get "19.06.1999" when I do "SELECT". I think the problem is that the date is stored as time with 00:00:00 hours. Is it a bug in my code, in Postgresql JDBC driver or somewhere else ? Please help. Martin Kuba -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ INET, a.s. Mgr. Martin Kuba Kralovopolska 139 e-mail: makub@inet.cz 601 12 Brno WWW: http://www.inet.cz/~makub/ Czech Republic tel: +420-5-41242414/33 -------------------------------------------------------------------- PGP fingerprint = D8 57 47 E5 36 D2 C1 A1 C3 48 B2 59 00 58 42 27 http://wwwkeys.cz.pgp.net:11371/pks/lookup?op=index&search=makub --------------------------------------------------------------------