This Oracle tutorial explains how to use the Oracle/PLSQL LOCALTIMESTAMP function with syntax and examples.
The Oracle/PLSQL LOCALTIMESTAMP 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 value.
The syntax for the LOCALTIMESTAMP function in Oracle/PLSQL is:
There are no parameters or arguments for the LOCALTIMESTAMP function.
The LOCALTIMESTAMP function returns a TIMESTAMP value.
The LOCALTIMESTAMP function can be used in the following versions of Oracle/PLSQL:
Let's look at some Oracle LOCALTIMESTAMP function examples and explore how to use the LOCALTIMESTAMP function in Oracle/PLSQL.
For example:
If the following ALTER SESSION command was issued:
And then the following SQL statement was executed:
You might get the following result:
You then modified the session time zone with the following ALTER SESSION command:
And then the following SQL statement was executed:
You would now get the following result:
The session time zone value has changed from -7:0 to -2:0, causing the LOCALTIMESTAMP function to return the current date and time as a value 5 hours ahead.