Oracle 时间戳、最大值和最小值

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9761236/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:40:29  来源:igfitidea点击:

Oracle Timestamp, Max and Minimal Values

oracledatetimestamp

提问by kamahl

I was searching, also in the Oracle Doc, for the following:

我也在 Oracle Doc 中搜索以下内容:

  • What is the range for Timestamp in Oracle?
  • Oracle 中时间戳的范围是多少?

I know for date it is -4712, Jan-01 to 9999 Dec-31, but what for Timestamp?

我知道日期是 -4712, Jan-01 到 9999 Dec-31,但是 Timestamp 呢?

Anyone a clue or hint where I can search?

任何人都有线索或提示我可以在哪里搜索?

回答by eaolson

You can always just try it:

您可以随时尝试:

SQL> select to_timestamp( '9999-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss' ) from dual;

TO_TIMESTAMP('9999-12-3123:59:59','YYYY-MM-DDHH24:MI:SS')
---------------------------------------------------------------------------
31-DEC-99 11.59.59.000000000 PM

and:

和:

SQL> select to_timestamp( '9999-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss' )+1 from dual;
select to_timestamp( '9999-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss' )+1 from dual
                                                                     *
ERROR at line 1:
ORA-01841: (full) year must be between -4713 and +9999, and not be 0

回答by Jonathan Leffler

It would be surprising if the range for the DATE portion of a TIMESTAMP was smaller than the range for a DATE, so it should be:

如果 TIMESTAMP 的 DATE 部分的范围小于 DATE 的范围,那将是令人惊讶的,因此它应该是:

-4712-01-01 00:00:00  to 9999-12-31 23:59:59.999999

That assumes no time zone; the UTC value is probably constrained to that range, but someone in an Eastern time zone might manage to see a data value on 1000-01-01 in their time zone.

假设没有时区;UTC 值可能被限制在该范围内,但东部时区的人可能会设法在他们的时区中看到 1000-01-01 上的数据值。

It is hard to find definitive data off Oracle's site. The best I found in a casual survey was:

很难在 Oracle 的站点上找到确定的数据。我在一次随意调查中发现的最好的是:

There are probably others.

可能还有其他人。



I found a quote which says:

我找到了一个引用,上面写着:

TIMESTAMP Datatype

The TIMESTAMP datatype is an extension of the DATE datatype. It stores the year, month, and day of the DATE datatype, plus hour, minute, and second values.

时间戳数据类型

TIMESTAMP 数据类型是 DATE 数据类型的扩展。它存储 DATE 数据类型的年、月和日,以及小时、分钟和秒值。