DATEADD Function - SQL Server Documentation

Overview

The DATEADD function adds a specified number of days, months, years, or fractional years to a date or interval.

Syntax

                
                DATEADD ( date-part, date-or-interval, number-of-units)
                
            

Parameters

Examples

SELECT DATEADD(day, 7, GETDATE()); -- Adds 7 days to the current date.
SELECT DATEADD(month, 3, '2023-10-26'); -- Adds 3 months to 2023-10-26, resulting in 2024-01-26.
SELECT DATEADD(year, 5, '2020-01-01'); -- Adds 5 years to 2020-01-01, resulting in 2025-01-01.

Related Topics