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
Returns the current timestamp for the system, but in the UTC time zone.
Current time: 03:29:55 UTC. UTC is replaced with Z that is the zero UTC offset. UTC time in ISO-8601 is 03:29:55Z. Note that the Z letter without a space.
SYS_EXTRACT_UTC extracts the UTC (Coordinated Universal Time--formerly Greenwich Mean Time) from a datetime value with time zone offset or time zone region name. Examples.
This documentation for Oracle Database seems to say that TIMESTAMP WITH TIME ZONE type does record the incoming data's time zone or offset-from-UTC.
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;
select sys_extract_utc(systimestamp) from dual;
Won't work on Oracle 8, though.
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