查看数据库与会话时区:
select dbtimezone,sessiontimezone from dual;
查看系统时间与会话时间:
select CURRENT_DATE,sysdate,CURRENT_TIMESTAMP,SYSTIMESTAMP from dual;
查看会话的时间戳格式:
SELECT VALUE FROM NLS_SESSION_PARAMETERS WHERE PARAMETER = 'NLS_TIMESTAMP_FORMAT';
查看会话时间转换用的语言:
SELECT VALUE FROM NLS_SESSION_PARAMETERS WHERE PARAMETER = 'NLS_DATE_LANGUAGE';
查看系统时间戳:
select to_char(systimestamp,'YYYY-MM-DD HH24:MI:SS.FF6 TZR') from dual;
将系统时间戳转化为本地会话时区时间格式:
select to_char(systimestamp at local,'YYYY-MM-DD HH24:MI:SS.FF6 TZR') from dual;
对数据库时间戳进行时区转换:
select from_tz(cast(sysdate as timestamp),dbtimezone) at time zone '+08:00' from dual;
数据库时间戳转换为本地会话时间戳:
select from_tz(cast(sysdate as timestamp),dbtimezone) at local from dual;