Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Can you help me with JDBC getDate() error?

Re: Can you help me with JDBC getDate() error?

From: Spare Brain <spare_brain_at_yahoo.com>
Date: Tue, 1 Feb 2005 22:03:58 -0500
Message-ID: <ctpeti$8d4@kcweb01.netnews.att.com>


"Joe Weinstein" <joeNOSPAM_at_bea.com> wrote in message news:42003788.1050606_at_bea.com...
>
>
> Spare Brain wrote:
>
> > Hi,
> >
> > I am observing a strange error with the time portion of the
java.sql.Date()
> > when using resultSet.getDate() - it always seems to show 12:00:00.
> >
> > The following code prints 2004-10-27 11:00:00.0
> >
> > String dtStr = resultset.getString("PROMISEDATE");
> > System.out.println(dtStr);
> >
> > The following code prints 2004-10-27 12:00:00
> > java.util.Date dt = resultset.getDate("PROMISEDATE");
> > System.out.println(new SimpleDateFormat("yyyy-MM-dd
> > hh:mm:ss").format(dt));
> >
> > Any clue why the getDate screws up the time? Any remedies you may
suggest?
>
> Yes, because it's a Date (date only). Try getTimestamp().
> Joe Weinstein at BEA
>
>
> >
> > Many thanks
> > SB
> >
> >
> >
>

That worked!!! Thanks Joe.
SB Received on Tue Feb 01 2005 - 21:03:58 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US