troubleshooting Question

SQL Server get last day of month and add one year to it

Avatar of Sandy Sailer
Sandy SailerFlag for United States of America asked on
MySQL Server
7 Comments1 Solution543 ViewsLast Modified:
I need to query a database and get the last day of the month for the current month and then add one year to that date.  For example, if today's date is 11/18/2011, I would need it to pull the last day of this month, which would be 11/30/2011 and then add one year to that date, which would bring it to 11/30/2012.  This is where I'm at so far (I can get the last day of the month), but I can't get the query to add one year to the last day of the current month.

DATEADD(Month, DATEDIFF(Month, - 1, GETDATE()), - 1) AS LastDayOfMonth

Thank you!
ASKER CERTIFIED SOLUTION
onlyaymie

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros