Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YDBlM-0004zy-7D for pgsql-jdbc@arkaria.postgresql.org; Mon, 19 Jan 2015 12:49:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YDBlL-0004sF-6Y for pgsql-jdbc@arkaria.postgresql.org; Mon, 19 Jan 2015 12:48:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YDBlK-0004s9-JG for pgsql-jdbc@postgresql.org; Mon, 19 Jan 2015 12:48:58 +0000 Received: from mwork.nabble.com ([162.253.133.43]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YDBlG-0007MO-Dh for pgsql-jdbc@postgresql.org; Mon, 19 Jan 2015 12:48:57 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mwork.nabble.com (Postfix) with ESMTP id 2C60010FE022 for ; Mon, 19 Jan 2015 04:48:54 -0800 (PST) Date: Mon, 19 Jan 2015 05:48:52 -0700 (MST) From: Vinayak To: pgsql-jdbc@postgresql.org Message-ID: <1421671732288-5834546.post@n5.nabble.com> In-Reply-To: <54B9433B.6070706@ttc-cmc.net> References: <1421061400959-5833623.post@n5.nabble.com> <1421123270940-5833702.post@n5.nabble.com> <1421131374401-5833708.post@n5.nabble.com> <1421213697306-5833860.post@n5.nabble.com> <1421386506791-5834215.post@n5.nabble.com> <54B9433B.6070706@ttc-cmc.net> Subject: Re: Problem with DATE MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -0.3 (/) 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 Hi, I tried to use setDate() instead of setObject() but still it gives the same error. Example: ps = conn.prepareStatement("SELECT ?"); java.sql.Date sqlDate1 = new java.sql.Date(new java.util.Date().getTime()); ps.setDate(6, sqlDate1); The problem here is java DATE have timezone and time. The comment in the PostgreSQL jdbc driver code: // We must use UNSPECIFIED here, or inserting a Date-with-timezone into a // timestamptz field does an unexpected rotation by the server's TimeZone: // // We want to interpret 2005/01/01 with calendar +0100 as // "local midnight in +0100", but if we go via date it interprets it // as local midnight in the server's timezone: // template1=# select '2005-01-01+0100'::timestamptz; // timestamptz // ------------------------ // 2005-01-01 02:00:00+03 // (1 row) // template1=# select '2005-01-01+0100'::date::timestamptz; // timestamptz // ------------------------ // 2005-01-01 00:00:00+03 // (1 row) ----- Regards, Vinayak, -- View this message in context: http://postgresql.nabble.com/Problem-with-DATE-tp5833008p5834546.html Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com. -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc