Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5g7I-0006EF-AA for pgsql-jdbc@arkaria.postgresql.org; Wed, 13 Feb 2013 17:27:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U5g7H-00010j-J8 for pgsql-jdbc@arkaria.postgresql.org; Wed, 13 Feb 2013 17:27:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5g7G-0000yx-6n for pgsql-jdbc@postgresql.org; Wed, 13 Feb 2013 17:27:30 +0000 Received: from outbound.vnet-inc.com ([216.146.104.103]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U5g7C-0007kV-5Q for pgsql-jdbc@postgresql.org; Wed, 13 Feb 2013 17:27:29 +0000 Received: from [192.168.157.132] (unknown [76.75.27.41]) by outbound.vnet-inc.com (Postfix) with ESMTP id 9A67459DC; Wed, 13 Feb 2013 10:27:24 -0700 (MST) Message-ID: <511BCCC1.7050404@ttc-cmc.net> Date: Wed, 13 Feb 2013 10:26:25 -0700 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.13) Gecko/20100914 SeaMonkey/2.0.8 MIME-Version: 1.0 To: Dave Cramer , pgsql-jdbc@postgresql.org Subject: Re: Timestamp vs. Java Date/Timestamp References: <1360043227.14635.9.camel@localhost> <1360733845.24220.50.camel@localhost> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org I agree that more things would break then fix. setDate() should not be used to fill a PostgreSQL TIMESTAMP data type field. It is fine to use in the application java.util.Date, but then just convert it to the TIMESTAMP type for PostgreSQL in setTimeStamp() by using java.util.Date.getTime(). Insure the format is correct though with a SimpleDateFormat. Timestamp With Time Zone, timestamptz, can also be handle exactly the same way by just using the formatter to include a time zone. SimpleDateFormat timeStampFormat; java.sql.Timestamp dateTimeValue; java.util.Date dateParse; timeStampFormat = new SimpleDateFormat("yyyy-MM-DD HH:mm:ss z"); dateParse = timeStampFormat.parse("2008-12-30 15:16:08 MST"); dateTimeValue = new java.sql.Timestamp(dateParse.getTime()); prepared_sqlStatement.setTimestamp(i++, dateTimeValue); danap Dave Cramer wrote: > And I think that is the way it will remain. I'm afraid this would break > way more than it would fix > > > > Dave Cramer -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc