Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YDSRA-0007tT-4t for pgsql-jdbc@arkaria.postgresql.org; Tue, 20 Jan 2015 06:37:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YDSR9-0006Ig-1f for pgsql-jdbc@arkaria.postgresql.org; Tue, 20 Jan 2015 06:37:15 +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 1YDSR8-0006Ia-GM for pgsql-jdbc@postgresql.org; Tue, 20 Jan 2015 06:37:14 +0000 Received: from mwork.nabble.com ([162.253.133.43]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YDSR5-0002OD-29 for pgsql-jdbc@postgresql.org; Tue, 20 Jan 2015 06:37:12 +0000 Received: from msam.nabble.com (unknown [162.253.133.85]) by mwork.nabble.com (Postfix) with ESMTP id 2DFC411138A6 for ; Mon, 19 Jan 2015 22:37:08 -0800 (PST) Date: Mon, 19 Jan 2015 23:37:08 -0700 (MST) From: Vinayak To: pgsql-jdbc@postgresql.org Message-ID: <1421735828048-5834706.post@n5.nabble.com> In-Reply-To: <54BD3D71.2070403@ttc-cmc.net> References: <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> <1421671732288-5834546.post@n5.nabble.com> <54BD3D71.2070403@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, ps = conn.prepareStatement("SELECT to_date(?,'yyyy-mm-dd')"); java.sql.Date sqlDate1 = new java.sql.Date(new java.util.Date().getTime()); ps.setDate(1, sqlDate1); This works fine because here driver sent the DATE type instead of UNSPECIFIED to the server. we can also use the below solution for such problems: ps = conn.prepareStatement("SELECT to_date(?,'yyyy-mm-dd')"); OR ps = conn.prepareStatement("SELECT ?::date"); OR ps = conn.prepareStatement("SELECT date(?)"); ----- Regards, Vinayak, -- View this message in context: http://postgresql.nabble.com/Problem-with-DATE-tp5833008p5834706.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