The SYSDATE function is one of the most popular and frequently used functions in Oracle SQL. Its purpose is simple: it returns a single DATE value representing the current date and time of the operating system where the database server is located.
What is the SYSDATE Function in Oracle?
The SYSDATE function returns the current date and time as a DATE data type. In Oracle, the DATE type always includes both the date (year, month, day) and the time (hours, minutes, seconds).
This is crucial to remember, as your query tool might only display the date part by default (e.g., 07-NOV-25) unless you format it.
SYSDATE vs. CURRENT_DATE
A common point of confusion is the difference between SYSDATE and CURRENT_DATE:
SYSDATE: Returns the date and time of the database server's operating system. If your server is in New York, it returns New York time.CURRENT_DATE: Returns the date and time of your SQL session's time zone. If you are in London, it returns London time (assuming your session is set correctly).
SYSDATE Function Syntax
The syntax for SYSDATE is one of the simplest, as it takes no arguments:
SYSDATE
A Note on Viewing Results
To see the full date and time returned by SYSDATE, it's best to either use TO_CHAR (as in Example 1) or run this command in your session first:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
Oracle SYSDATE Function Examples
Here are two practical examples of how to use SYSDATE.
Example 1: Getting the Current Server Time with SYSDATE
This example shows how to select the current server time and use the TO_CHAR function to format it in a specific, readable way.
Query:
SELECT
TO_CHAR(SYSDATE, 'MM-DD-YYYY HH24:MI:SS') AS "NOW"
FROM DUAL;
Result: (The result will be the server's time when you run the query.)
NOW
-------------------
11-07-2025 08:20:15
Example 2: Using SYSDATE in Date Arithmetic
This is the most common use for SYSDATE. You can perform simple arithmetic with it to find past or future dates.
SYSDATE - 1= Yesterday at this exact time.SYSDATE + 7= One week from now at this exact time.
Query:
SELECT
SYSDATE AS "Now",
SYSDATE - 1 AS "Yesterday",
SYSDATE + 7 AS "Next_Week"
FROM DUAL;
Result: (Assuming "Now" is 08:30 on Nov 7th, 2025)
Now Yesterday Next_Week
-------------------- -------------------- --------------------
07-NOV-2025 08:30:00 06-NOV-2025 08:30:00 14-NOV-2025 08:30:00