Why does Oracle have the wrong time zones? Chicago is off by an hour, Denver is off by an hour, etc.
The Linux server's time as well as Oracle's sessiontimezone and dbtimezone are correct.
Oracle's current_date does differ from sysdate by an hour. They should be the same.
SELECT tzabbrev, SUBSTR(tz_offset(tzname), 1, 6), tzname FROM v$timezone_names tz WHERE tzname = 'America/Denver';
LMT -07:00 America/Denver
MST -07:00 America/Denver
MWT -07:00 America/Denver
MDT -07:00 America/Denver
These should all be -06:00!
It doesn't:
ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF9 TZH:TZM';
SELECT SYSTIMESTAMP AT TIME ZONE 'UTC',
SYSTIMESTAMP AT TIME ZONE 'America/Denver'
FROM DUAL;
Outputs:
SYSTIMESTAMPATTIMEZONE'UTC' SYSTIMESTAMPATTIMEZONE'AMERICA/DENVER' 2021-06-29 22:09:27.786125000 +00:00 2021-06-29 16:09:27.786125000 -06:00
If you do:
ALTER SESSION SET TIME_ZONE = 'America/Denver';
Then:
SELECT SYSTIMESTAMP, CURRENT_TIMESTAMP FROM DUAL;
Then the output on db<>fiddle (which is in the UK and currently on UTC+1):
SYSTIMESTAMP CURRENT_TIMESTAMP 2021-06-29 23:09:27.788275000 +01:00 2021-06-29 16:09:27.788278000 -06:00
I assume that your server time zone is set to UTC-7 and your session time zone is set to America/Denver (UTC-6) and you are using SYSTIMESTAMP which is getting the server time rather than the session time which CURRENT_TIMESTAMP would return.
db<>fiddle here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With