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
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())
Use the dateadd() function
SELECT dateadd(mm, 1, '19-Apr-2012')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With