In Oracle/PLSQL, the current_timestamp function returns the current date and time in the time zone of the current SQL session as set by the ALTER SESSION command. It returns a TIMESTAMP WITH TIME ZONE value.
A similar function to the current_timestamp function is the localtimestamp function. The difference between these two functions is that the current_timestamp function returns a TIMESTAMP WITH TIME ZONE value while the localtimestamp function returns a TIMESTAMP value.
Syntax
The syntax for the current_timestamp function is:
current_timestamp
Applies To
- Oracle 11g, Oracle 10g, Oracle 9i
For Example
If the following ALTER SESSION command was issued:
ALTER SESSION SET TIME_ZONE = '-7:0';
And then the following SQL statement was executed:
select current_timestamp from dual;
You might get the following result:
10-Sep-05 10.58.24.853421 PM -07:00
You then modified the session time zone with the following ALTER SESSION command:
ALTER SESSION SET TIME_ZONE = '-2:0';
And then the following SQL statement was executed:
select current_timestamp from dual;
You would now get the following result:
10-Sep-05 03.58.24.853421 AM -02:00
The session time zone value has changed from -7:0 to -2:0, causing the current_timestamp function to return the current date and time as a value 5 hours ahead.