Find time zone.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 09 Jun 2017 13:56:41 +0300
changeset 2147 e6dcc210bd6b
parent 2146 274a3e6678ba
child 2148 8588bb3cd896
Find time zone.
oracle.rst
--- a/oracle.rst	Wed Jun 07 23:41:55 2017 +0300
+++ b/oracle.rst	Fri Jun 09 13:56:41 2017 +0300
@@ -272,6 +272,41 @@
 
  * http://docs.oracle.com/cd/B19306_01/em.102/b40103/app_oracle_reserved_words.htm
 
+Find time zone
+==============
+
+Set TZ data formt::
+
+  alter session set 'YYYY-MM-DD HH24:MI:SS.FF3 TZR';
+
+For system TZ look to TZ in::
+
+  select SYSTIMESTAMP from dual;
+
+For session TZ look to TZ in::
+
+  select CURRENT_TIMESTAMP from dual;
+
+or directly in::
+
+  select SESSIONTIMEZONE from dual;
+
+You can adjust session TZ by::
+
+  alter session set TIME_ZONE ='+06:00';
+
+which affect on ``CURRENT_DATE``, ``CURRENT_TIMESTAMP``, ``LOCALTIMESTAMP``.
+
+``DBTIMEZONE`` is set when database is created and can't be altered if the
+database contains a table with a ``TIMESTAMP WITH LOCAL TIME ZONE`` column and
+the column contains data::
+
+  select DBTIMEZONE from dual;
+
+Find time at timezone::
+
+  select SYSTIMESTAMP at time zone 'GMT' from dual;
+
 Adjust date format.
 ===================
 ::
@@ -284,6 +319,8 @@
   alter session set NLS_TIMESTAMP_FORMAT = 'MI:SS.FF6';
   alter session set NLS_TIME_FORMAT = 'HH24:MI:SS.FF6';
 
+  alter session set TIME_ZONE = '+06:00';
+
   select sysdate from dual;
 
 Working with SQL/Plus.