Skip site navigation (1) Skip section navigation (2)

Re: issues with Statement.getTimestamp(int, Calendar)

From: Ravi Periasamy <ravitx12(at)yahoo(dot)com>
To: Dave Cramer <pg(at)fastcrypt(dot)com>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>, pgsql-jdbc(at)postgresql(dot)org, Ravi Periasamy <ravitx12(at)yahoo(dot)com>
Subject: Re: issues with Statement.getTimestamp(int, Calendar)
Date: 2006-12-13 11:47:18
Message-ID: 752250.99365.qm@web60525.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Dave,

I'm in Asia/Calcutta (India) time zone. It is +5.30
from GMT.

I'm almost certain there's a bug in
Statement.getTimestamp(int, Calendar). Where as,
Resultset.getTimestamp(int, Calendar) gives the
correct value. 

I suspect the AbstractJdbc2Statement.changetime()
method.

Thanks
Ravi

--- Dave Cramer <pg(at)fastcrypt(dot)com> wrote:

> Ravi,
> 
> what is your time zone from what you have my guess
> would be -9:00 ?
> 
> I think the JVM adjusts the actual time to your
> local timezone when  
> it prints it.
> 
> Dave
> On 12-Dec-06, at 11:05 PM, Ravi Periasamy wrote:
> 
> > The test case is as follows.
> >
> > I created a function as follows:
> > ==================================================
> > create or replace function testouttimestamp(OUT a1
> > timestamp) AS $$
> > begin
> >   a1 := '1970-01-01 00:00:00';
> > end;
> > $$ language plpgsql;
> > ==================================================
> >
> > and called through JDBC as follows:
> > ==================================================
> > TimeZone tz = TimeZone.getTimeZone("GMT");
> > Calendar cr = Calendar.getInstance(tz);
> > CallableStatement stmt = con.prepareCall( "{call
> > testouttimestamp(?)}");
> > stmt.registerOutParameter(1, Types.TIMESTAMP);
> > stmt.execute();
> > Timestamp ts = stmt.getTimestamp(1, cr);
> > System.out.println("ts = " + ts);
> > ==================================================
> >
> > Actual Result ==>
> > 1969-12-31 18:30:00.0
> >
> > Expected Result ==>
> > 1970-01-01 05:30:00.0
> >
> > Note: ResultSet.getTimestamp(int, Calendar) works
> > fine.
> >
> > Thanks
> > Ravi
> >
> > --- Oliver Jowett <oliver(at)opencloud(dot)com> wrote:
> >
> >> Ravi Periasamy wrote:
> >>> Dear PSQL-JDBC team,
> >>>
> >>> There is a issue with
> Statement.getTimestamp(int,
> >>> Calendar). The timestamp is offset in the wrong
> >>> direction.
> >>>
> >>> The quivalent on ResultSet.getTimestamp(int,
> >> Calendar)
> >>> works fine.
> >>>
> >>> Is this a known bug, can we expect a fix for
> this,
> >>> when?
> >>
> >> Can you send a testcase demonstrating the problem
> >> please?
> >>
> >> -O
> >>
> >
> >
> >
> >
> >
>
______________________________________________________________________
> 
> > ______________
> > Want to start your own business?
> > Learn how on Yahoo! Small Business.
> > http://smallbusiness.yahoo.com/r-index
> >
> > ---------------------------(end of  
> > broadcast)---------------------------
> > TIP 4: Have you searched our list archives?
> >
> >                http://archives.postgresql.org
> >
> 
> 



 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

In response to

Responses

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2006-12-13 12:28:19
Subject: Re: issues with Statement.getTimestamp(int, Calendar)
Previous:From: Dave CramerDate: 2006-12-13 11:38:09
Subject: Re: issues with Statement.getTimestamp(int, Calendar)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group