Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> using TIMESTAMP with Java
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 Thu Feb 20 2003 - 08:26:09 CST