Microsoft Learn

Documentation for SQL Server

DATEADD (Transact-SQL)

Adds a specified time value to a specified date value.

Syntax

DATEADD ( datepart , number , date )

Parameters

Parameter Description Data type
datepart Specifies the part of the date to which the number is added. For a list of valid arguments, see Date and Time Data Types and Functions. varchar, nvarchar, or datetimepart
number The integer value to add to the date. This can be a positive or negative value. int
date The expression that returns a valid datetime, smalldatetime, date, varchar, nvarchar, or datetime2 value. datetime, smalldatetime, date, varchar, nvarchar, datetime2

Return Value

Type: datetime2 (unless the input date is of type date, in which case it returns date)
The function returns a valid datetime value.

Remarks

DATEADD returns a value that represents the date and time that is number intervals after the date. The following table lists the valid and recognized abbreviations for datepart arguments.

💡 Example

Add 10 days to a date

SELECT DATEADD(day, 10, '2023-10-26');

Result: 2023-11-05

Subtract 3 months from a date

SELECT DATEADD(month, -3, '2024-01-15');

Result: 2023-10-15

Add 2 years to the current date

SELECT DATEADD(year, 2, GETDATE());

Result: The current date plus two years.

See Also