From: Altaf Malik <mmalik_altaf@yahoo.com>
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: pgsql-jdbc@postgresql.org
Subject: Re: Strange behaviour of rs.getTimestamp
Date: Thu, 6 Jan 2011 06:50:04 -0800 (PST)
Message-ID: <766302.42702.qm@web110412.mail.gq1.yahoo.com> (raw)
In-Reply-To: <4D257BC90200002500039054@gw.wicourts.gov>
References: <416690.93407.qm@web110406.mail.gq1.yahoo.com>
<4D257BC90200002500039054@gw.wicourts.gov>
> So, what's different between the ones that yield the correct values
> and the ones that don't?
Please look at the values:
2009-04-15 00:00:00->2009-04-15 01:00:00.0
The value I inserted in table was 2009-04-15 00:00:00 and from rs.getString(1) I
got the same value. rs.getTimestamp(1) returned me a different value (note the
hour value is 1 instead of 0). The value I got is: 2009-04-15 00:00:00
> If you can put together a self-contained test case that someone can
> compile and run on their own machine, it becomes much easier for
> others to understand the problem and to help.
I did so. Please read the following portion carefully:
Statement stmt = con.createStatement();
stmt.executeUpdate("create table ts_test(a timestamp)");
stmt.executeUpdate("insert into ts_test values('15-APR-09');");
ResultSet rs = stmt.executeQuery("select * from ts_test");
while (rs.next()) {
Timestamp t = rs.getTimestamp(1);
System.out.println(rs.getString(1)+"->"+ t);
}
stmt.executeUpdate("drop table ts_test");
Regards,
Altaf Malik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: mmalik_altaf@yahoo.com, Kevin.Grittner@wicourts.gov
Subject: Re: Strange behaviour of rs.getTimestamp
In-Reply-To: <766302.42702.qm@web110412.mail.gq1.yahoo.com>
References: <416690.93407.qm@web110406.mail.gq1.yahoo.com> <4D257BC90200002500039054@gw.wicourts.gov> <766302.42702.qm@web110412.mail.gq1.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox