Oracle SYSDATE

The Oracle SYSDATE function returns the current date and time of the Operating System (OS) where the Oracle Database is running.

Syntax

Since the SYSDATE function does not require any argument, you can call it without specifying the parentheses:

SYSDATECode language: SQL (Structured Query Language) (sql)

Return value

The SYSDATE function returns the current date and time value whose type is DATE.

The format of the returned date time value depends on the value of the NLS_DATE_FORMAT parameter.

Examples

The following example returns the current date and time of the OS where the Oracle Database resides:

SELECT 
    TO_CHAR(SYSDATE, 'MM-DD-YYYY HH24:MI:SS') 
FROM 
    dual;
Code language: SQL (Structured Query Language) (sql)

In this example, we used the TO_CHAR() function to format the current system date and time value returned by the SYSDATE function.

The following table illustrates the arithmetic of the SYSDATE function:

SYSDATE MathDescription
WHERE (date) > SYSDATE - 8/24;Past 8 hours
WHERE (date) > SYSDATE - 30;Past 30 days
WHERE (date) > SYSDATE -
30/1440;
Past 30 minutes
8/248 hours
15/24/60/6015  seconds
1/24/60One minute
1/24One hour
TRUNC(SYSDATE+1/24,'HH')1 hour starting with the next
hour

Remarks

The Oracle SYSDATE function cannot be used in the condition of a CHECK constraint.

In this tutorial, you have learned how to use the Oracle SYSDATE function to get the current system date and time.

Was this tutorial helpful?