X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 02F5E5368A for ; Mon, 11 Apr 2005 11:57:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50872-10 for ; Mon, 11 Apr 2005 14:57:49 +0000 (GMT) Received: from av1-2-sn1.fre.skanova.net (av1-2-sn1.fre.skanova.net [81.228.11.108]) by svr1.postgresql.org (Postfix) with ESMTP id CD2FC5380F for ; Mon, 11 Apr 2005 11:57:47 -0300 (ADT) Received: by av1-2-sn1.fre.skanova.net (Postfix, from userid 502) id E06AC37E5A; Mon, 11 Apr 2005 16:57:51 +0200 (CEST) Received: from smtp3-2-sn1.fre.skanova.net (smtp3-2-sn1.fre.skanova.net [81.228.11.164]) by av1-2-sn1.fre.skanova.net (Postfix) with ESMTP id CC25F37E45; Mon, 11 Apr 2005 16:57:51 +0200 (CEST) Received: from w128mtec (h88n2fls35o269.telia.com [81.224.67.88]) by smtp3-2-sn1.fre.skanova.net (Postfix) with SMTP id 5978837E44; Mon, 11 Apr 2005 16:57:51 +0200 (CEST) Message-ID: <008901c53ea6$d955f6b0$8ba7e551@w128mtec> From: "mikael-aronsson" To: "Boris Kirzner" , References: <425A701C.6070608@mainsoft.com> Subject: Re: Bug in storing Timestamp Date: Mon, 11 Apr 2005 16:57:57 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200504/67 X-Sequence-Number: 12674 Hi ! I have never had any problems with timestamps, if I remember correct the resolution gets worse when you get far away from 1900 or so, is it possible that using year 0001 gives that bad resolution maybe ? Mikael ----- Original Message ----- From: "Boris Kirzner" To: Sent: Monday, April 11, 2005 2:39 PM Subject: [JDBC] Bug in storing Timestamp > Short description : > Storing java.sql.Timestamp with specified milliseconds value results to > wrong value stored in db. > > System details : > OS : WindowsXP > PostgreSQL version : 8.0.1 > Driver version : 8.0 build 310 > > Detailed description : > In order to reproduce the bug run the following code. > Create the table in the db. > The code creates a timestamp of "0001-01-01 02:02:02.0" and stores it into > the db. > The actual value stored is "02:22:42". > > > CREATE TABLE TYPES_EXTENDED ( > id char(10), > t_time time > ) > WITHOUT OIDS; > > long milliseconds = Timestamp.valueOf("0001-01-01 02:02:02.0").getTime(); > Timestamp javaTimestamp = new Timestamp(milliseconds); > System.out.println("Timestamp stored : " + javaTimestamp); > PreparedStatement stmt = connection.prepareStatement("insert into > types_extended(ID,t_time) values ('aaa',?)"); > stmt.setTimestamp(1, javaTimestamp); > stmt.execute(); > > > Thank you in advance, > > -- > Boris Kirzner > Mainsoft Corporation > http://www.mainsoft.com > > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly