# HG changeset patch # User Oleksandr Gavenko # Date 1497005801 -10800 # Node ID e6dcc210bd6b8de698e0453349526de9436d1a85 # Parent 274a3e6678baac39fc8ea876c21bf9eba86c4621 Find time zone. diff -r 274a3e6678ba -r e6dcc210bd6b 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.