Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

want to get time upto nanoseconds

Status
Not open for further replies.

selani

Programmer
Apr 30, 2003
35
0
0
IN
Hi all,

i want to get time upto nanoseconds.I tried using Timestamp class but did not serve the purpose.It saves the milli second value as nanos portion.That is wat i understood.
Can anyone help me?

thanx in advance
selani
 
Hi,

Thanx.i hv already tried wat u hv mentioned.
When i print the Timestamp obj i get the following output:
2003-08-08 10:08:54.478

getNanos returns the foll:
478000000

i.e. it is returning the milli sec part of time.Isn't it?
wat i want is nano seconds.i don't understand this.

Can u clarify?

 
According to the API doc :
Code:
"A thin wrapper around java.util.Date that allows the JDBC API to identify this as an SQL TIMESTAMP value. It adds the ability to hold the SQL TIMESTAMP nanos value and provides formatting and parsing operations to support the JDBC escape syntax for timestamp values." ,
it is my understanding that TimeStamp is a container to store the nanaseconds, but somebody has to put that value in e.g. the nanoseconds could be put in there via JDBC. Not via Date or Time or System.currentTimeMillis(), because they all do not contain nanoseconds.
 
It could well be that your JDBC driver (and/or your database) don't support greater precision.

Even if the data entered into the database has the desired precision, if the JDBC driver can't handle it it will not return it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top