Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get current GMT in Oracle

Tags:

sql

oracle

gmt

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.

like image 967
user1056038 Avatar asked Mar 18 '12 04:03

user1056038


1 Answers

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.

like image 82
Justin Cave Avatar answered Sep 24 '22 18:09

Justin Cave