views:

3862

answers:

2

Hello,

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

+3  A: 

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 = '-2:00';

Or read it

SELECT SESSIONTIMEZONE, CURRENT_TIMESTAMP FROM dual;
Jonathan
Well, the trick is to convert from SYSDATE.So first you will need to somehow establish what SESSIONTIMEZONE is, and use that knowledge in order to get the offset value for SYS_EXTRACT_UTC - won't you?
stic
Yes, You can check this link from oracle where Datetime and Time Zone Parameters: http://www.oracle.com/technology/obe/obe9ir2/obe-nls/datetime/datetime.htm
Jonathan
+1  A: 
select sys_extract_utc(systimestamp) from dual;

Won't work on Oracle 8, though.

Juris