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: using TIMESTAMP with Java

Re: using TIMESTAMP with Java

From: Oleg Paraschenko <usenet_at_sein.sportwetten.spb.ru>
Date: 21 Feb 2003 05:12:07 -0800
Message-ID: <70f723dc.0302210512.1f7a521f@posting.google.com>


Hello!

  Try to use "Timestamp" class instead of "Date" class on Java side.

--
Oleg

Axel Seinsche <newsgroup_at_seinsche.net> wrote in message news:<b32ogt$kmd$04$1_at_news.t-online.com>...

> Hi NG,
>
> I'm using an Oracle 9i Rel. 2 DB with a TIMESTAMP field. How do I save a
> time value with milliseconds via JDBC.
>
> As you can see below I use curentTimeMillis() to get my current date /
> time. The System.out.println shows the correct value! The time contains
> the milliseconds. But in my DB there are still no milliseconds to see.
>
> Any ideas?
>
> Axel
>
> long currentDate = System.currentTimeMillis();
> System.out.println("My date: " + new
> java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:s:SSS").format(new
> Date(currentDate)));
>
> System.out.println("SQL date: " + new Timestamp(currentDate).toString());
Received on Fri Feb 21 2003 - 07:12:07 CST

Original text of this message

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