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: Java (new Date()).getTime() - java.util.Timestamp("select timestamp from dual").getTime() ???

Re: Java (new Date()).getTime() - java.util.Timestamp("select timestamp from dual").getTime() ???

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 23 May 2007 16:59:28 -0700
Message-ID: <1179964768.818684.262870@m36g2000hse.googlegroups.com>


On May 22, 4:34 pm, Joerg Weule <jwe..._at_arcor.de> wrote:
> Hello,
>
> I tried to retrieve a timestamp from my database independent from the
> local TZ environment variable. The ResultSet.getTimestamp(...).getTime()
> method should return the number of seconds after "1.1.1970 GMT" like
> (new Date()).getTime() .
>
> Is there any timestamp (current, local, sys, ...) to get the correct time?
>
> Thanks in advance
>
> Jörg
>
> --------------------------------------------------------
> export TZ=...
>
> run :
>
> PreparedStatement s = c.prepareStatement(
> "SELECT ?????????? FROM dual");
> ResultSet rs = s.executeQuery();
> rs.next();
> t3 = rs.getTimestamp(1,java.util.Calendar.getInstance());
> System.out.println(
> "Timestamp-Error:"
> +rs.getTimestamp(1).getTime()-(new Date().getTime());
> rs.close() ;
> s.close() ;

I do not code java so I have no idea if you can use this the way your post shows but the Oracle function current_timestamp returns a timestamp value equal to the current database time.

HTH -- Mark D Powell -- Received on Wed May 23 2007 - 18:59:28 CDT

Original text of this message

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