sql add date – How to Add Days to a Date in SQL?

sql add date – DATEADD(): Functions is used when we want to get date by adding days or month or year in given date. The ADDDATE() function adds a time/date interval to a date and then returns the date.

sql add date – DATEADD SQL function introduction and overview

sql add date – DATEADD(), How to get new date by adding Days, month or years in MS SQL database? . We can use the SQL SERVER DATEADD function to get a new column after adding the required date value.

Syntax : DATEADD Function

DATEADD( interval, number, date )

Syntax – DATEADD(DATEPART, number, datecolumn)


sql server current date minus 5 years

           DATEADD(day,-2,GETDATE()) 'Today - 2 Days'
           DATEADD(dd,-2,GETDATE()) 'Today - 2 Days'
           DATEADD(d,-2,GETDATE()) 'Today - 2 Days'

datetime add 2 hours sql

Read Also:  Simple Calculator Using PHP - Calculator Example With Source Code


The following table lists the valid values of date_part:

date_part abbreviations
year yy, yyyy
quarter qq, q
month mm, m
dayofyear dy, y
day dd, d
week wk, ww
hour hh
minute mi, n
second ss, s
millisecond ms
microsecond mcs
nanosecond ns

How to add days to the current date?

Select (Getdate()+360) As MyDate

How to add time to DateTime in SQL

SELECT DATEADD(day, DATEDIFF(day, 0, GETDATE()), '03:30:00')

Query to get Date & time after 6 days from current datetime in MS SQL:

Read Also:  PHP Laravel Multiple Where Condition using Eloquent

Select DATEADD(DAY, 6, GETDATE()) as NewDatetime

Query to get Date & time 6 days ago from current datetime in MS SQL:

Select DATEADD(DAY, -6, GETDATE()) as NewDatetime

Add 6 Months to Current Date:

Select DATEADD(MONTH, 6, GETDATE()) as NewDatetime

Add 6 years to Current Date:

Select DATEADD(YEAR, 6, GETDATE()) as NewDatetime

Don’t Miss : How To Insert Date In Mysql Using Php?

I hope you get an idea about sql add date.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.