1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Check sysdate in gmt

Discussion in 'SQL PL/SQL' started by jhonnyrip, Jul 16, 2018.

  1. jhonnyrip

    jhonnyrip Active Member

    Messages:
    39
    Likes Received:
    1
    Trophy Points:
    90
    Location:
    lansing
    I need check sysdate should be GMT and if not need send email. Can somebody provide sql, how i check .
     
  2. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,639
    Likes Received:
    368
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    You can't if your session isn't using GMT; you need to use systimestamp to get that information:

    Code (SQL):
    SQL> SELECT systimestamp at TIME zone 'GMT' FROM dual;

    SYSTIMESTAMPATTIMEZONE'GMT'
    ---------------------------------------------------------------------------
    17-JUL-18 01.45.24.745000 PM GMT
     
     
  3. jhonnyrip

    jhonnyrip Active Member

    Messages:
    39
    Likes Received:
    1
    Trophy Points:
    90
    Location:
    lansing
    i want to check SYSDATE in GMT or different timezone.
     
  4. zargon

    zargon Community Moderator Forum Guru

    Messages:
    2,639
    Likes Received:
    368
    Trophy Points:
    1,430
    Location:
    Aurora, CO
    You cannot as SYSDATE has no timezone associated with it; SYSTIMESTAMP does and the code you need has already been posted. SYSDATE uses the database timezone, no other.