Wednesday, November 19, 2008

SQL - What is the difference between SYSDATE and CURRENT_DATE?

Quite simply SYSDATE returns the time on the server where the database instance is running.

Where as CURRENT_DATE returns the time where the session is running (adjusted for the session's time zone).

And you can alter the session's time zone using the following commands:
ALTER SESSION SET TIME_ZONE = 'MST'
ALTER SESSION SET TIME_ZONE = '-5:0'
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS'

No comments:

Post a Comment

Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.