Difference between oracle DATE and TIMESTAMP

What is the difference between Oracle DATE and TIMESTAMP types? Do both have a date and time? Also what is the corresponding type in Java for these date types?

+49
oracle oracle11g jdbc
Oct 02 '13 at 15:44
source share
1 answer

DATE and TIMESTAMP are the same size (7 bytes). These bytes are used to store eyelids, decades, years, months, days, hours, minutes and seconds. But TIMESTAMP allows you to store additional information, such as fractional seconds (11 bytes) and fractional seconds with a time zone (13 bytes).

TIMESTAMP was added as ANSI, compatible with Oracle. Before that, he had only DATE.

In general cases, you should use DATE. But if time accuracy is a requirement, use TIMESTAMP.

And about Java, the oracle.sql.DATE class from the Oracle JDBC driver provides conversions between the Oracle Date / Timestamp data type and the Java classes java.sql.Date, java.sql.Time, and java.sql.Timestamp.

+54
02 Oct '13 at 16:55 on
source share



All Articles