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.