All Products
Search
Document Center

Data Transmission Service:dbtimezone

Last Updated:Oct 31, 2023

Background information

dbtimezone in timestamp at time zone dbtimezone is not supported in PolarDB O Edition.

SQL> SELECT timestamp '1970-01-01 0:0:0 -0:0' at time zone dbtimezone FROM dual;
TIMESTAMP'1970-01-010:0:0-0:0'ATTIMEZONEDBTIMEZONE
---------------------------------------------------------------------------
01-JAN-70 12.00.00.000000000 AM +00:00
SQL> 
SQL> SELECT CURRENT_TIMESTAMP FROM dual;
CURRENT_TIMESTAMP
---------------------------------------------------------------------------
04-AUG-20 06.04.42.125059 PM +08:00

Solutions

We recommend that you change the time zone to a specific value based on the dbtimezone settings in the ORACLE database, for example, +00:00. The time zone of PolarDB can be modified based on the timezone parameter and can be adjusted at the server level or the session level.

van=> set timezone='+08:00';
SET
van=> select current_timestamp;
    current_timestamp     
---------------------------------- 
04-AUG-20 02:03:27.686021 -08:00
(1 row)
van=> set timezone='UTC';
SET
van=> select current_timestamp;
    current_timestamp
     ----------------------------------
 04-AUG-20 10:03:49.071727 +00:00
(1 row)

For more information, see https://www.postgresql.org/docs/11/functions-datetime.html.