|
SQL > SQL Date Functions >
Sysdate Function
The SYSDATE function is used to retrieve the current database system time in Oracle and MySQL. A common use of SYSDATE is to get today's date.
SYSDATE returns the current system date and time in Oracle (no parentheses) and MySQL (requires parentheses); for SQL Server, use the equivalent GETDATE() function instead.
Syntax in Oracle
The syntax of SYSDATE in Oracle is simply,
It does not require any argument.
Example in Oracle
The SQL statement,
SELECT SYSDATE FROM DUAL;
produces the following result when run on January 16, 2000.
Syntax in MySQL
The syntax of SYSDATE in MySQL is simply,
It does not require an argument.
Example in MySQL
The SQL statement,
produces the following result when run on January 16, 2000, at 09:06:22 AM.
| SYSDATE |
| 2000-01-16 09:06:22 |
The SQL Server equivalent of SYSDATE is GETDATE.
List of SQL Date Functions
| Function Name | Description |
| DATEADD | Adds an interval to a date value in SQL Server. |
| DATEDIFF | Calculates the difference between two dates in MySQL and SQL Server. |
| DATEPART | Extracts a specific part of a date/time value in SQL Server. |
| GETDATE | Retrieves database time in SQL Server. |
| SYSDATE | Retrieves database time in Oracle and MySQL. |
| EXTRACT | Retrieves a certain component of a date or timestamp value. |
Frequently Asked Questions
- What does SYSDATE do in SQL?
- SYSDATE returns the current database system date and time. In Oracle, write it as SYSDATE (no parentheses). In MySQL, write it as SYSDATE(). The SQL Server equivalent is GETDATE().
- What is the difference between SYSDATE in Oracle and MySQL?
- In Oracle, SYSDATE returns only the date portion by default (though it includes the time internally). In MySQL, SYSDATE() returns a full datetime value including hours, minutes, and seconds.
- What is the SQL Server equivalent of SYSDATE?
- SQL Server uses GETDATE() to retrieve the current system date and time. It is not called SYSDATE in SQL Server.
- What is the difference between SYSDATE() and NOW() in MySQL?
- NOW() returns the timestamp at the start of the SQL statement's execution, while SYSDATE() returns the exact time when the function is called. In simple queries they return the same value, but they can differ inside stored procedures or multi-statement scripts.
Next: SQL EXTRACT Function
This page was last updated on March 19, 2026.
Copyright © 2026 1keydata.com All Rights Reserved
Privacy Policy About Contact |