LOCALTIMESTAMP

LOCALTIMESTAMP returns a TIMESTAMP for the session.


SQL> SELECT LOCALTIMESTAMP FROM dual;

LOCALTIMESTAMP
-----------------------------------------------
08-JUL-12 10.21.19.837000 AM

SQL> ALTER SESSION SET TIME_ZONE = 'EST';

Session altered.

SQL> SELECT LOCALTIMESTAMP FROM dual;

LOCALTIMESTAMP
-----------------------------------------------
08-JUL-12 01.21.19.868000 PM

SQL> ALTER SESSION SET TIME_ZONE = 'PST';

Session altered.

SQL> SELECT LOCALTIMESTAMP FROM dual;

LOCALTIMESTAMP
-----------------------------------------------
08-JUL-12 10.21.21.509000 AM

SQL>

LOCALTIMESTAMP(t) can have parameter: t t islocal time zone's fractional second precision. Ranges between 0 and 9. Optional; defaults to 6.


SQL> SELECT LOCALTIMESTAMP(4) FROM   DUAL;

LOCALTIMESTAMP(4)
--------------------------------------------
08-JUL-12 10.22.11.2270 AM

SQL>
Home »
Oracle »
Timestamp Functions » 

Related: