简体   繁体   中英

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..

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM