Reputation: 189
What function can I use to get the date for the following month, in the format 201907?
The following code snippet returns 201907, but I need a function that will always return the next month
select
convert(varchar(6), DATEFROMPARTS(YEAR(GETDATE()), 7, 1), 112)
Upvotes: 1
Views: 57
Reputation: 5208
You can use DATEADD
:
SELECT CONVERT(varchar(6), DATEADD(MONTH, 1, GETDATE()), 112)
Upvotes: 4