Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: using TIMESTAMP with Java
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>...Received on Fri Feb 21 2003 - 07:12:07 CST
> 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());
![]() |
![]() |