DATEADD function in SQL

The DATEADD function in SQL is used to add (or subtract) a specified time interval to a date and return the resulting date. It is commonly used for operations like adding days, months, or years to a date.

SQL Syntax

DATEADD(datepart, number, date)

The following are the parameters of the function:

Example: Add 10 Days to the Current Date.

SQL Syntax

SELECT DATEADD(day, 10, GETDATE()) AS NewDate;

If today is 2024-10-10, the result will be:

NewDate
2024-10-30 20:24:13.120