How to get current GMT in Oracle

user1056038 picture user1056038 · Mar 18, 2012 · Viewed 27.3k times · Source

I'm trying to get the current GMT/UTC regardless of the time zones my current database is located. The possible solution I found is:

SELECT SYSTIMESTAMP AT TIME ZONE dbtimezone FROM DUAL;

and it is giving me the current GMT, but I am not 100% confident if this is the right way. Would anyone please help provide the best way to get the current GMT? Thanks.

Answer

Justin Cave picture Justin Cave · Mar 18, 2012

If you want the current time in GMT, you'd want

SELECT systimestamp AT TIME ZONE 'GMT'
  FROM dual

That will work regardless of the dbtimezone.