In this section, we cover common date functions seen in SQL. Different database systems have different formats for date-type data, and each RDBMS may employ different date functions, and there may also be differences in the syntax for each RDBMS even when the function call is the same. All such differences are explained in each section. Please note that we do not list all possible SQL date functions in this tutorial. Rather, the most commonly used ones are covered.
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. |