Skip to content

Instantly share code, notes, and snippets.

@marcelodeandrade
Created March 27, 2018 19:56
Show Gist options
  • Save marcelodeandrade/3cee238cbd5ae248b11cfee1deb27e06 to your computer and use it in GitHub Desktop.
Save marcelodeandrade/3cee238cbd5ae248b11cfee1deb27e06 to your computer and use it in GitHub Desktop.
Get the next day of week starting from date
DECLARE @NextDayID INT = 4 -- 0=Mon, 1=Tue, 2 = Wed, ..., 5=Sat, 6=Sun
SELECT DATEADD(DAY, (DATEDIFF(DAY, @NextDayID, GETDATE()) / 7) * 7 + 7, @NextDayID) AS NextDay
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment