Oracle: Current date in the specified session time zone
Oracle Datetime: Exercise-3 with Solution
Write a Oracle SQL statement to get the current date in the specified session time zone.
Sample Solution:
Oracle Code:
ALTER SESSION SET TIME_ZONE = '-8:0';
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
SELECT SESSIONTIMEZONE, CURRENT_DATE FROM DUAL;
ALTER SESSION SET TIME_ZONE = '-9:0';
SELECT SESSIONTIMEZONE, CURRENT_DATE FROM DUAL;
Output:
SESSIONTIMEZONE CURRENT_DATE 1 -08:00 2/24/2021 3:31:46 AM SESSIONTIMEZONE CURRENT_DATE 1 -09:00 2/24/2021 2:31:46 AM
Improve this sample solution and post your code through Disqus.
Previous: Write a Oracle SQL statement to get the last date of the current month.
Next: Write a Oracle SQL statement to determine how many days are left in the current month.
What is the difficulty level of this exercise?
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework