Babu R
Babu R

Reputation: 1035

How to get date/time with millisecond from oracle database using java?

I have the following TIMESTAMP value in oracle database.

26-JUL-12 11.01.40.000000000 AM

When i getting this value from table , it displays without millisecond value like,

26-JUL-12 11.01.40 AM

But, i want to get this value like this format,

26-JUL-12 11.01.40.000 AM

Is there any possible to get timestamp value in this format?

Please help me.

Thanks in advance..

Upvotes: 1

Views: 20564

Answers (2)

Raj
Raj

Reputation: 31

select to_char(systimestamp,'dd-mon-rrrr hh:mi:ss:ff3am') from dual;

Upvotes: 3

chinna_82
chinna_82

Reputation: 6403

This article states:

An Oracle DATE stores the date and time to the second. An Oracle TIMESTAMP stores the date and time to up to 9 digits of subsecond precision, depending on the available hardware.

Both are implemented by storing the various components of the date and the time in a packed binary format. From the Oracle Concepts Guide section on dates

Oracle uses its own internal format to store dates. Date data is stored in fixed-length fields of seven bytes each, corresponding to century, year, month, day, hour, minute, and second.

You can use the DUMP() function to see the internal representation of any particular date (or any other value for that matter), but that's probably more than you need (or want) to know.

Upvotes: 1

Related Questions