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 94C1032A6CB for ; Thu, 14 Oct 2004 13:10:53 +0100 (BST) 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 76296-03 for ; Thu, 14 Oct 2004 12:10:46 +0000 (GMT) Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id 9ADE9329F4C for ; Thu, 14 Oct 2004 13:10:32 +0100 (BST) Received: (qmail 16946 invoked by uid 1112); 14 Oct 2004 12:10:32 -0000 Date: Thu, 14 Oct 2004 07:10:31 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Jair da Silva Ferreira Jr Cc: pgsql-jdbc@postgresql.org Subject: Re: problem with dates when using a java calendar object with In-Reply-To: <416DB991.3060809@amazon.com.br> Message-ID: References: <416DB991.3060809@amazon.com.br> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200410/148 X-Sequence-Number: 11253 On Wed, 13 Oct 2004, Jair da Silva Ferreira Jr wrote: > I don't care about the time (hour, minute and second) > difference as this is a SQL DATE type. The problem is that the days in > these dates are different. There are a number of problems going on here: First the JDBC driver didn't support using an alternate Calendar until very recently. This functionality is only in the 8.0 series. Second it doesn't make sense to store a timezone with a date alone. You need time information as well, so you've selected the wrong pg datatype "date" and should probably be using "timestamp with time zone". Finally the javadoc says To conform with the definition of SQL DATE, the millisecond values wrapped by a java.sql.Date instance must be 'normalized' by setting the hours, minutes, seconds, and milliseconds to zero in the particular time zone with which the instance is associated. I believe this means your whole setTimeInDate method is not legal. Kris Jurka