Add One or More Days to Date in SQL Server

Day can be added to date or datetime in sql server using the following function.

Function :

DATEADD( datepart, number, date )

Arguments :

datepart : It is the part of date ( ex : day – for adding days to the date specified in 3rd argument )

number : It is an integer which is added to the datepart ( ex : day ) of date

date : date , to which we want to add number of days

Examples  :

1. Add 2 days to date : 2014-09-24

OUTPUT

( 2014-09-24 ) + 2 days
—————————-
2014-09-26 00:00:00.000

 

2. Getting today and tomorrow ( today + 1 day )

OUTPUT
      Today                       Tomorrow
----------------------------------------------------
2014-09-25 23:56:43.757      2014-09-26 23:56:43.757

References :

http://msdn.microsoft.com/en-us/library/ms186819.aspx

 

Author of CodeForEach.com . Loves coding and related technologies.
 

www.000webhost.com