You can also use it to subtract a specified time period. I am trying to add days to the current date and its working fine but when I add 3days to the current date it gives me wrong value. Is there a way to use the dateadd() in the.

DATEADD Function For SQL. We want to retrieve records from Orders table. How to format date in SQL? Dateadd is an date function and returns a date with the specified number interval added.
Date math is an important part of working with SQL. Winner of Best BI Software for SQL. Move Forward With Confidence. Get the Most out of Your Data. Watch the Free Tableau Video Demo!
Connecting With The Data Community. For professionals just getting started with SQL Server, these functions are some of the first to become familiar with. Hours, minutes, months, and days can be added to any date value.
Also, look at the syntax, the return type, and arithmetic on months. Add a specified time interval to a date. Syntax DateAdd (interval, number, date) Key interval The interval of time to add. The number of intervals to add. The date to which the interval is added.
This example takes a date an using the DateAdd function , displays a corresponding date a specified number of days in the future. The following code will accomplish the task. Copy and paste the following into SQL Management Studio and hit Run to create a new function available for future queries.
