Re: Problem with DATE

From: Vinayak <vinpokale(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problem with DATE
Date: 2015-01-07 07:01:08
Message-ID: 1420614068412-5833152.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I tried to connect PostgreSQL using the version 2 protocol.
but the result showing the timezone part.
example:
2014-01-11 +05:30:00

PostgreSQL has TIMESTAMP and TIMESTAMPTZ type but in JAVA there is only
setTimestamp() and if we use protocolVersion "2" then the result showing the
time zone value.

Example:
For timestamp(without timezone):
java.sql.Timestamp sqlDate = new java.sql.Timestamp(new
java.util.Date().getTime());
ps.setTimestamp(5, sqlDate);
Result:
2015-01-07 12:18:03.150000 +05:30:00

So I think instead of using protocolVersion "2" its better to typecast the
argument.

-----
Regards,
Vinayak,

--
View this message in context: http://postgresql.nabble.com/Problem-with-DATE-tp5833008p5833152.html
Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2015-01-09 03:25:02 Re: JDBC compression over SSL
Previous Message Vinayak 2015-01-07 05:01:36 Re: Problem with DATE