问题描述
使用此查询:select sysdate from dual;
结果是:27-09-2018 07:50:50
-- 这个UK
时间
the result is: 27-09-2018 07:50:50
-- this UK
time
with : 从dual中选择dbtimezone;
输出:+10:00
我希望 sysdate
与 dbtimezone
我试图用 alter database set time_zone='AEST'
来实现,但我有点困惑这是否是正确的解决方案.
I was trying to do it with alter database set time_zone='AEST'
, but i'm bit confused if this is the right solution.
最感谢任何帮助.谢谢.
Any help most appreciated.Thanks.
推荐答案
DBTIMEZONE
是 SYSDATE
和 SYSTIMESTAMP
It is a common misunderstanding that DBTIMEZONE
is the time zone for SYSDATE
and SYSTIMESTAMP
SYSDATE
和 SYSTIMESTAMP
以数据库服务器所在操作系统的时区返回.
SYSDATE
and SYSTIMESTAMP
are returned in time zone of the operating system on which the database server resides.
DBTIMEZONE
是 TIMESTAMP WITH LOCAL TIME
值的(内部)时区.我不知道它有什么实际用途.请注意,如果数据库包含具有 TIMESTAMP WITH LOCAL TIME ZONE
列的表并且该列包含数据,则不能更改数据库上的 DBTIMEZONE
.
DBTIMEZONE
is the (internal) time zone of TIMESTAMP WITH LOCAL TIME
values. I don't know any practical use of it. Note, you cannot change DBTIMEZONE
on your database if the database contains a table with a TIMESTAMP WITH LOCAL TIME ZONE
column and the column contains data.
如果你想在 DBTIMEZONE 运行当前时间
If you want current time at DBTIMEZONE run
select SYSTIMESTAMP AT TIME ZONE DBTIMEZONE
from dual;
CURRENT_TIMESTAMP AT TIME ZONE DBTIMEZONE
也有效.
这篇关于Oracle 数据库中的 sysdate 和 dbtimezone 不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!