• Skip to primary navigation
  • Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql

how to use localtimestamp function in oracle database query

Oracle LOCALTIMESTAMP Function

November 5, 2012 by techhoneyadmin

SQL LocalTimeStamp FunctionOracle LOCALTIMESTAMP Function returns current date and time of the current SQL session.
Oracle LOCALTIMESTAMP returns the TIMESTAMP value.


Oracle LOCALTIMESTAMP Function Syntax

SELECT LOCALTIMESTAMP
FROM table_name;

Oracle LOCALTIMESTAMP returns date and time as set by the ALTER SESSION statement.


Oracle LOCALTIMESTAMP – Using SQL SELECT Statement Example

Oracle LOCALTIMESTAMP is used with SQL SELECT Statement to fetch current date and timestamp.

For example, the below SQL SELECT query will return current date and timestamp.

SELECT LOCALTIMESTAMP
FROM DUAL;

May return something like “11/5/2012 12:09:00.807000 AM”


Oracle LOCALTIMESTAMP – Using ALTER SESSION Example

We can use the ALTER SESSION SET TIME_ZONE to change the time zone of the database.

For example, the SQL SELECT query below will return the date and time after we have altered the database timezone.

ALTER SESSION SET TIME_ZONE = '-7:0';

And then we query the LOCALTIMESTAMP as

SELECT LOCALTIMESTAMP
FROM DUAL;

May return something like “11/5/2012 12:09:21.186000 AM” because the time zone has been altered


Oracle LOCALTIMESTAMP – Using TRUNC Function Example

LOCALTIMESTAMP Function can be used with the SQL TRUNC Function to remove the timestamp part.

For example, the SQL query below returns only the date part from Oracle LOCALTIMESTAMP Function.

SELECT TRUNCT(localtimestamp)
FROM dual;

May return something like “11/5/2012”.


Filed Under: function Tagged With: how to use localtimestamp function in oracle database query, how to use localtimestamp function in oracle plsql, how to use localtimestamp function in oracle sql, localtimestamp function in oracle plsql, localtimestamp function in oracle sql, LOCALTIMESTAMPPLSQL, syntax and example of localtimestamp function in oracle database query, syntax and example of localtimestamp function in oracle plsql, syntax and example of localtimestamp function in oracle sql, using localtimestamp function in oracle database query, using localtimestamp function in oracle plsql, using localtimestamp function in oracle sql

Copyright © 2025 · Parallax Pro on Genesis Framework · WordPress · Log in