oracle DATE和TIMESTAMP之间的区别 [英] Difference between oracle DATE and TIMESTAMP

查看:344
本文介绍了oracle DATE和TIMESTAMP之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Oracle DATE和TIMESTAMP类型有什么区别? 两者都有日期和时间部分吗? 这些日期类型在Java中还对应什么类型?

What are the difference between Oracle DATE and TIMESTAMP type? Both have date and time component? Also what is corresponding type in Java for these date types?

推荐答案

DATE和TIMESTAMP具有相同的大小(7个字节).这些字节用于存储世纪,十年,年,月,日,小时,分钟和秒.但是TIMESTAMP允许存储其他信息,例如小数秒(11个字节)和带时区的小数秒(13个字节).

DATE and TIMESTAMP have the same size (7 bytes). Those bytes are used to store century, decade, year, month, day, hour, minute and seconds. But TIMESTAMP allows to store additional info such as fractional seconds (11 bytes) and fractional seconds with timezone (13 bytes).

TIMESTAMP被添加为符合Oracle的ANSI.在此之前,它只有DATE.

TIMESTAMP was added as an ANSI compliant to Oracle. Before that, it had DATE only.

通常情况下,您应该使用DATE.但是,如果需要时间精确度,请使用TIMESTAMP.

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

关于Java,Oracle JDBC驱动程序中的oracle.sql.DATE类提供了Oracle Date/Timestamp数据类型与Java类java.sql.Date,java.sql.Time和java.sql.Timestamp之间的转换.

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

这篇关于oracle DATE和TIMESTAMP之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆