How to get UTC value for SYSDATE on Oracle

stic picture stic · Jul 21, 2009 · Viewed 146.2k times · Source

Probably a classic... Would you know a easy trick to retrieve an UTC value of SYSDATE on Oracle (best would be getting something working on the 8th version as well).

For now I've custom function :(

Cheers,

Stefan

Answer

Jonathan picture Jonathan · Jul 21, 2009

You can use

SELECT SYS_EXTRACT_UTC(TIMESTAMP '2000-03-28 11:30:00.00 -02:00') FROM DUAL;

You may also need to change your timezone

ALTER SESSION SET TIME_ZONE = 'Europe/Berlin';

Or read it

SELECT SESSIONTIMEZONE, CURRENT_TIMESTAMP FROM dual;