The CURRENT_TIMESTAMP function returns the current date in the time zone of the current session. The return value is of the TIMESTAMP WITH TIME ZONE data type and contains the information about the current time zone.
Syntax
CURRENT_TIMESTAMP (precision)
Parameters
| Parameter | Description |
|---|---|
| precision | The precision of the fractional part of seconds. Default value: 6. Valid values: 0 to 9. |
Return type
TIMESTAMP WITH TIME ZONE data type that includes the information about the current time zone in its value
Examples
In the following examples, the CURRENT_TIMESTAMP function returns different results for different time zones of sessions.
Set the current time zone to GMT-5:
ALTER SESSION SET TIME_ZONE = '-05:00';
Execute the following statement to call the function:
SELECT CURRENT_TIMESTAMP FROM DUAL;
The following query result is returned:
+------------------------------------+
| CURRENT_TIMESTAMP |
+------------------------------------+
| 2020-03-08 01:49:31.219066 -05:00 |
+------------------------------------+
Change the current time zone to GMT+8 and change the precision of the fractional part of seconds to 3:
ALTER SESSION SET TIME_ZONE = '+08:00';
Execute the following statement to call the function:
SELECT CURRENT_TIMESTAMP(3) FROM DUAL;
The following query result is returned:
+---------------------------------+
| CURRENT_TIMESTAMP(3) |
+---------------------------------+
| 2020-03-08 14:50:32.499 +08:00 |
+---------------------------------+