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.