How to calculate a date after 1 month currentDate

date, sql, sql-server-2008

Solution

You can use DATEADD (datepart , number , date )

as specified here

Examples (thanks to DarrenDavis)

for month:

 select dateadd(m, 1, getdate())

for year:

 select dateadd(YY, 1, getdate())

Problem

How can I calculate a date after a month of current date. Example if I have 19/04/2012 I want to get 19/05/2012. Is there any function on sql that allows doing this? I need to do the same for a year also like 19/04/2012 and set 19/04/2013 Cheers

Original source

Related problems