How can I add the time zone offset in the third query?
SELECT SESSIONTIMEZONE FROM DUAL;
# +01:00
SELECT TZ_OFFSET(SESSIONTIMEZONE) FROM DUAL;
# +01:00
SELECT TO_CHAR(TO_TIMESTAMP('19700101000000','YYYYMMDDHH24MISS')+NUMTODSINTERVAL(86400,'SECOND'),'YYYY-MM-DD HH24:MI:SS') FROM DUAL;
# 1970-01-02 00:00:00
The desired result would be
# 1970-01-02 01:00:00
Use
FROM_TZto convert yourTIMESTAMPto aTIMESTAMP WITH TIME ZONEon theUTCtime zone and then useAT TIME ZONE SESSIONTIMEZONEto convert it to your local time and then convert it back to a string:Then:
or, more simply:
fiddle