Purpose
This function returns the current date in the current session time zone as a value of the TIMESTAMP data type.
The difference between this function and the CURRENT_TIMESTAMP function is that the CURRENT_TIMESTAMP function returns a value of the TIMESTAMP WITH TIME ZONE data type.
Syntax
LOCALTIMESTAMP [(timestamp_precision)]
Parameters
timestamp_precision specifies the precision of the fractional seconds, which is an integer in the range [0,9]. This parameter is optional. The default value is 6.
Return type
TIMESTAMP
Examples
Set the current time zone to GMT-5 and use the
LOCALTIMESTAMPfunction to return the current date.obclient> ALTER SESSION SET TIME_ZONE = '-05:00'; Query OK, 0 rows affected obclient> SELECT LOCALTIMESTAMP FROM DUAL; +------------------------------+ | LOCALTIMESTAMP | +------------------------------+ | 17-NOV-21 04.36.28.557316 AM | +------------------------------+ 1 row in setSet the current time zone to GMT+8 and adjust the fractional seconds precision to
3. Use theLOCALTIMESTAMPfunction to return the current date.obclient> ALTER SESSION SET TIME_ZONE = '+08:00'; Query OK, 0 rows affected obclient> SELECT LOCALTIMESTAMP(3) FROM DUAL; +---------------------------+ | LOCALTIMESTAMP(3) | +---------------------------+ | 17-NOV-21 05.38.12.839 PM | +---------------------------+ 1 row in set
