Oracle Tutorial

  • Home
  • Start Here
  • Basics
  • Advanced
    • Oracle View
    • Oracle Index
    • Oracle Synonym
    • Oracle Sequence
    • Oracle Administration
  • PL/SQL
  • Functions
    • Aggregate Functions
    • Analytic Functions
    • Comparison Functions
    • Date Functions
    • String Functions
  • API
    • Python Oracle
Home / Oracle Date Functions / Oracle CURRENT_TIMESTAMP

Oracle CURRENT_TIMESTAMP

The Oracle CURRENT_TIMESTAMP function returns the current date and time in session time zone.

Noted that the CURRENT_TIMESTAMP function returns a value of TIMESTAMP WITH TIME ZONE while the CURRENT_DATE function returns a value of DATE without time zone data.

Syntax

The following illustrates the syntax of the Oracle CURRENT_TIMESTAMP function:

CURRENT_TIMESTAMP(factional_second_precision)
Code language: SQL (Structured Query Language) (sql)

Arguments

1) factional_second_precision

The function accepts an optional argument named factional_second_precision that determines the number of fractional second precision in the returned time value.

If you omit the factional_second_prevision argument, it defaults to 6.

Return Value

The Oracle CURRENT_TIMESTAMP returns a value of the current timestamp in TIMESTAMP WITH TIME ZONE data type.

Examples

The following statement changes the format of timestamp values to include the time components:

ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
Code language: SQL (Structured Query Language) (sql)

The following example shows the current timestamp in the session time zone:

SELECT CURRENT_TIMESTAMP FROM dual;
Code language: SQL (Structured Query Language) (sql)

Here is the output:

06-AUG-17 08.26.52.742000000 PM -07:00
Code language: SQL (Structured Query Language) (sql)

Let’s try to change the session time zone to the new one:

ALTER SESSION SET TIME_ZONE = '-08:00';
Code language: SQL (Structured Query Language) (sql)

And get the current timestamp again:

SELECT CURRENT_TIMESTAMP FROM dual;
Code language: SQL (Structured Query Language) (sql)

As you can see, the current timestamp was adjusted to the new session time zone as shown below:

06-AUG-17 07.50.48.004000000 PM -08:00
Code language: SQL (Structured Query Language) (sql)

Remarks

Notice that the CURRENT_TIMESTAMP returns a TIMESTAMP WITH TIME ZONE value while the LOCALTIMESTAMP returns a TIMESTAMP value without the time zone data.

In this tutorial, you have learned how to use the Oracle CURRENT_TIMESTAMP function to get the current timestamp in session time zone.

  • Was this tutorial helpful?
  • YesNo
Previous Oracle CURRENT_DATE
Next Oracle EXTRACT

Oracle Functions

  • Aggregate Functions
  • Analytic Functions
  • Comparison Functions
  • Date Functions
  • String Functions

Oracle Date Functions

  • ADD_MONTHS
  • CURRENT_DATE
  • CURRENT_TIMESTAMP
  • DBTIMEZONE
  • EXTRACT
  • FROM_TZ
  • LAST_DAY
  • LOCALTIMESTAMP
  • MONTHS_BETWEEN
  • NEXT_DAY
  • NEW_TIME
  • ROUND
  • SESSIONTIMEZONE
  • SYSDATE
  • SYSTIMESTAMP
  • TO_CHAR
  • TO_DATE
  • TRUNC
  • TZ_OFFSET

About Oracle Tutorial

OracleTututorial.com website provides Developers and Database Administrators with the updated Oracle tutorials, scripts, and tips.

Search

Recent Tutorials

  • Oracle Implicit Statement Results
  • Calling PL/SQL Stored Functions in Python
  • Calling PL/SQL Procedures in Python
  • Managing Transaction in Python
  • Deleting Data From Oracle Database in Python

Site Links

  • Oracle Books
  • About
  • Contact
  • Privacy Policy
  • Terms of Use

Copyright © 2021 Oracle Tutorial. All Rights Reserved.